minor fixes

This commit is contained in:
jkriege2 2019-02-09 18:46:12 +01:00
parent d886757a1c
commit 8ce6987315
5 changed files with 44 additions and 278 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,267 +1,6 @@
#include <QApplication>
#include <QLabel>
#include <QPainter>
#include <QPixmap>
#include <QScrollArea>
#include <QDebug>
#include <QHBoxLayout>
#include <QTextBrowser>
#include "jkqtmathtext/jkqtmathtext.h"
#include "jkqtplottertools/jkqtphighrestimer.h"
#include "testform.h"
#define W 2000
#define H 3000
#define X1 15
#define Y1 50
/*
HighResTimer ht;
double draw(QPainter& painter, double X, double YY, JKQTMathText& mt, QString name) {
double Y=YY;
painter.save();
ht.start();
QSizeF s=mt.getSize(painter);
Y=Y+mt.getAscent(painter);
std::cout<<" sizing in "<<ht.getTime()/1000.0<<" ms\n";
QPen p=painter.pen();
p.setColor("lightcoral");
p.setStyle(Qt::DashLine);
p.setWidth(2);
painter.setPen(p);
QRectF r(X, Y-mt.getAscent(painter),s.width(), s.height());
painter.drawRect(r);
p.setColor("lightblue");
painter.setPen(p);
painter.drawLine(X, Y, X+s.width(), Y);
ht.start();
p.setStyle(Qt::SolidLine);
p.setWidth(1);
p.setColor("black");
painter.setPen(p);
mt.draw(painter, X, Y);
std::cout<<" drawing in "<<ht.getTime()/1000.0<<" ms\n";
p.setColor("blue");
painter.setPen(p);
QFont f;
f.setFamily("sans serif");
f.setUnderline(true);
f.setPointSize(10);
painter.setFont(f);
painter.drawText(X, Y-mt.getAscent(painter)-6, name+":");
painter.restore();
std::cout<<name.toStdString()<<": width="<<s.width()<<" height="<<s.height()<<" ascent="<<mt.getAscent(painter)<<" descent="<<mt.getDescent(painter)<<std::endl;
return mt.getDescent(painter)+mt.getAscent(painter)+40;
}
void timingTest(QPainter& painter, QString text, QString name, double fontSize) {
double sum_parse=0;
double sum_size=0;
double sum_draw=0;
double sqrsum_parse=0, sqrsum_size=0, sqrsum_draw=0;
int N=20;
std::cout<<"testing '"<<name.toStdString()<<"':\nparse [ms],\tsize [ms],\tdraw [ms]\n---------------------------------------------\n";
for (int i=0; i<N; i++) {
double t;
JKQTMathText mt;
mt.setFontSize(fontSize);
ht.start(); mt.parse(text); t=ht.getTime()/1000.0;
sum_parse+=t;
sqrsum_parse+=t*t;
//std::cout<<t<<",\t";
ht.start(); mt.getSize(painter); t=ht.getTime()/1000.0;
sum_size+=t;
sqrsum_size+=t*t;
//std::cout<<t<<",\t";
ht.start(); mt.draw(painter, 0,0); t=ht.getTime()/1000.0;
sum_draw+=t;
sqrsum_draw+=t*t;
//std::cout<<t<<"\n";
}
//std::cout<<"---------------------------------------------\n";
std::cout<<sum_parse/(double)N<<",\t"<<sum_size/(double)N<<",\t"<<sum_draw/(double)N<<"\t: average\n";
std::cout<<sqrt(sqrsum_parse-sum_parse*sum_parse/(double)N)/(double)N<<",\t"<<sqrt(sqrsum_size-sum_size*sum_size/(double)N)/(double)N<<",\t"<<sqrt(sqrsum_draw-sum_draw*sum_draw/(double)N)/(double)N<<"\t: std dev\n";
std::cout<<"\n\n";
}
int main(int argc, char* argv[])
{
std::cout<<sizeof(unsigned char)<<" "<<sizeof(unsigned short)<<" "<<sizeof(unsigned int)<<" "<<sizeof(unsigned long)<<" "<<sizeof(unsigned long long)<<"\n\n";
QString mathTest="This is normal text: $this is math:\\langle r^2(\\tau)\\rangle=\\left\\langle (\\vec{r}(t)-\\vec{r}(t+\\tau) )^2\\right\\rangle\\ \\ \\ g(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1} \\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\left\\{\\va\\left|\\|\\va\\|_2\\geq2\\right.\\right\\} \\vr\\vR\\frac{\\sqrt{\\sqrt{\\sqrt{\\sum_{i=0}^\\infty \\hat{i}^2}+y^\\alpha}+1}}{\\dot{v}\\equiv\\ddot{r}}\\argmin_{\\vec{k}}\\sum_{\\sqrt{i}=0}^{N}\\int_{x_0}^{x_1}\\left(\\left(\\left(x\\right)\\right)\\right)\\underbrace{\\left[\\left\\{\\frac{\\partial f}{\\partial x}\\right\\}\\cdot\\frac{1}{2}\\right]}{\\text{underbraced text \\hbar}}\\cdots\\frac{\\sqrt{\\sum_{i=0}^2 \\hat{i}^2}+y^\\alpha}{\\dot{v}\\equiv\\ddot{r}}, \\hat{t}\\hat{T} \\overbrace{\\left|\\sqrt{x\\cdot Y}\\right|}{\\propto\\bbN\\circ\\bbZ} \\left<\\arrow{x(\\tau)}\\cdot\\vec{R}(t+\\bar{\\tau})\\right> \\alpha\\beta\\gamma\\delta\\epsilon\\Gamma\\Delta\\Theta\\Omega \\left\\_\\left~\\cbrt{\\hbar\\omega}\\right~\\right\\_$";
QString symbolTest="\\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\sum\\int \\iint \\oint \\prod \\leftrightarrow \\leftarrow\\Leftarrow\\rightarrow\\Rightarrow\\pm\\mp\\leq\\geq\\ll\\gg\\hbar\\euro\\bbC\\bbH\\bbN\\bbP\\bbQ\\bbZ\\bbR\\Angstrom\\Alef\\Bet\\Gimel\\Dalet\\nexists\\ni\\notni\\circ\\tilde\\oiint\\oiiint\\emptyset\\odot\\ominus\\subsetnot\\DC\\bot\\cdots\\perthousand\\leftharpoonup\\rightharpoonup \\upharpoonleft \\downharpoonleft \\leftrightharpoon \\rightleftharpoon \\coprod \\leftharpoondown \\rightharpoondown \\nwarrow \\nearrow \\mapsto \\cent \\pound \\yen \\div \\multimap \\maporiginal \\mapimage \\bigcap \\bigcup \\benzene \\times \\cdot \\propto \\equiv \\Im \\Re \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ ";
//QString mathTest="$\\left\\|\\stackrel{1}{2}\\right\\|\\cdot\\left|\\begin{Bmatrix}1123&2^2&\\frac{3}{4}\\\\4&5_5&6\\\\72_8&8_{\\text{längerer Index}}&9&10&11\\end{Bmatrix}\\right|\\cdots f(x)$";
//QString mathTest="0";
//QString text="x_0 \\sqrt{a^2+b^2}\\underbrace{underbrace}{x_0} (\\bf{Test})\\_\\it{Text} ... ! Äquator\\alpha\\beta $f(x)=\\sin(x{\\cdot}y)$ \\ul{Text\\ol{\\gamma}} \\script{Script}, \\tt{Typewriter}, \\sf{sans serif}";
//QString text="$\\sum_{i=0_{j=-1_{k=-45}}}^{n^{m^{123456789}}}\\left(\\left(\\left(\\int_0^\\inf\\left[r+i^{\\left\\{2^2\\right\\}}\\right]{\\dd}r\\right)\\right)\\right)$ \\bf{Test}\\_\\it{Text} ... ! \\sc{&Äquator \\&}\\alpha\\beta $f(x)=\\sin(x\\cdot\\cos(a+{\\ii}b))$ \\ul{Text\\gamma} \\script{Script-Text}\\tt{ and Typewriter} \\sf{also sans serif}";
//QString text="$\\sum_{i=0_{j=-1_{k=-45}}}^2\\left(\\left(\\left(\\int_0^\\inf\\left[r+i^{\\left\\{2^2\\right\\}}\\right]{\\dd}r\\right)\\right)\\right)$ \\bf{Test}\\_\\it{Text} ... ! \\sc{&Äquator \\&}\\alpha\\beta $f(x)=\\sin(x\\cdot\\cos(a+{\\ii}b))$ \\ul{Text\\gamma} \\script{Script-Text}\\tt{ and Typewriter} \\sf{also sans serif}";
QString text="x_0My Text$\\sqrt{a^2+b^2 } \\underbrace{underbrace}{x_0}$";
QApplication app(argc, argv);
QWidget w;
QHBoxLayout lay(&w);
w.setLayout(&lay);
QScrollArea area;
QTextBrowser browser;
lay.addWidget(&area);
lay.addWidget(&browser);
QLabel win;
area.setBackgroundRole(QPalette::Dark);
area.setWidget(&win);
QPixmap pix(W, H), pix2(W,H);
pix.fill();
QPainter painter;
JKQTMathText mt(&win);
double Y=Y1;
painter.begin(&pix);
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::HighQualityAntialiasing);
painter.setRenderHint(QPainter::TextAntialiasing);
ht.start();
mt.setFontRoman("Times New Roman");
mt.setFontMathRoman("Times New Roman");
mt.setFontSans("Arial");
mt.setFontMathSans("Arial");
mt.setFontTypewriter("Courier");
mt.parse(mathTest);
bool okh=true;
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML1: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML1: --------------------------------------------- ok="<<okh;
if (mt.getErrorList().size()>0) {
std::cout<<mt.getErrorList().join("\n").toStdString()<<std::endl<<std::endl;
}
std::cout<<"parse mathTest in "<<ht.getTime()/1000.0<<" ms\n";
mt.setFontSize(10);
Y+=draw(painter, X1, Y, mt, "math, symbol, 10pt");
mt.setFontSize(20);
Y+=draw(painter, X1, Y, mt, "math, symbol, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.getTime()/1000.0<<" ms\n";
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
mt.setFontSize(12);
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.getTime()/1000.0<<" ms\n";
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
mt.setFontSize(10);
Y+=draw(painter, X1, Y, mt, "text, symbol, 10pt");
mt.setFontSize(16);
Y+=draw(painter, X1, Y, mt, "text, symbol, 16pt");
Y+=30;
mt.useXITS();
ht.start();
mt.parse(mathTest);
std::cout<<"parse mathTest in "<<ht.getTime()/1000.0<<" ms\n";
mt.setFontSize(10);
Y+=draw(painter, X1, Y, mt, "math, XITS, 10pt");
mt.setFontSize(20);
Y+=draw(painter, X1, Y, mt, "math, XITS, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.getTime()/1000.0<<" ms\n";
mt.setFontSize(12);
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.getTime()/1000.0<<" ms\n";
mt.setFontSize(10);
Y+=draw(painter, X1, Y, mt, "text, XITS, 10pt");
mt.setFontSize(16);
Y+=draw(painter, X1, Y, mt, "text, XITS, 16pt");
Y+=30;
mt.useAnyUnicode("Arial", "Times New Roman");
ht.start();
mt.parse(mathTest);
std::cout<<"parse mathTest in "<<ht.getTime()/1000.0<<" ms\n";
mt.setFontSize(10);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 10pt");
mt.setFontSize(20);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.getTime()/1000.0<<" ms\n";
mt.setFontSize(12);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.getTime()/1000.0<<" ms\n";
mt.setFontSize(10);
Y+=draw(painter, X1, Y, mt, "text, Arial Unicode, 10pt");
mt.setFontSize(16);
Y+=draw(painter, X1, Y, mt, "text, Arial Unicode, 16pt");
Y+=30;
mt.useSTIX();
ht.start();
mt.parse(mathTest);
std::cout<<"parse mathTest in "<<ht.getTime()/1000.0<<" ms\n";
mt.setFontSize(10);
Y+=draw(painter, X1, Y, mt, "math, STIX, 10pt");
mt.setFontSize(20);
Y+=draw(painter, X1, Y, mt, "math, STIX, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.getTime()/1000.0<<" ms\n";
mt.setFontSize(12);
Y+=draw(painter, X1, Y, mt, "math, STIX, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.getTime()/1000.0<<" ms\n";
mt.setFontSize(10);
Y+=draw(painter, X1, Y, mt, "text, STIX, 10pt");
mt.setFontSize(16);
Y+=draw(painter, X1, Y, mt, "text, STIX, 16pt");
painter.end();
// timing test
painter.begin(&pix2);
std::cout<<"timing test, font size 10pt:\n";
timingTest(painter, mathTest, "mathTest", 10);
timingTest(painter, text, "text", 10);
std::cout<<"timing test, font size 20pt:\n";
timingTest(painter, mathTest, "mathTest", 20);
timingTest(painter, text, "text", 20);
std::cout<<"timing test, font size 30pt:\n";
timingTest(painter, mathTest, "mathTest", 30);
timingTest(painter, text, "text", 30);
win.setPixmap(pix);
win.resize(W, H);
w.show();
w.showMaximized();
return app.exec();
}
*/
int main(int argc, char* argv[])
{
QApplication app(argc, argv);

View File

@ -41,6 +41,7 @@ TestForm::TestForm(QWidget *parent) :
ui->cmbTestset->addItem("math: bf", "$\\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: rm", "$\\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: cal", "$\\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("subsuperscript test", "$r_{123}^2$\\ \\ $r^2_{123}$\\ \\ $\\left(a\\right)_{123}^2$\\ \\ $\\left(a\\right)^2_{123}$\\ \\ $r_{\\frac{1}{2}}^2$\\ \\ $r^2_{\\frac{1}{2}}$\\ \\ $r^{\\frac{1}{2}}_2$\\ \\ $r_2^{\\frac{1}{2}}$\\ \\ $\\left(a\\right)_2^{\\frac{1}{2}}$\\ \\ $\\left(a\\right)^{\\frac{1}{2}}_2$");
ui->cmbTestset->addItem("subscript test", "$r_{123}\\ \\ r_{\\frac{1}{2}}$");
ui->cmbTestset->addItem("subscript0 test", "$r_{123}$");
ui->cmbTestset->addItem("subscript1 test", "$r_{123}\\ $");

View File

@ -695,7 +695,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
public:
MTnode(JKQTMathText* parent);
virtual ~MTnode();
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos)=0;
/** \brief determine the size of the node, calls getSizeInternal() implementation of the actual type \see getSizeInternal() */
void getSize(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
/** \brief draw the contents at the designated position. returns the x position which to use for the next part of the text */
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv)=0;
@ -713,6 +713,18 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
virtual void setDrawBoxes(bool draw);
virtual QString getTypeName() const;
protected:
/** \brief determine the size of the node, overwrite this function in derived classes
*
* \param painter painter to use for determining the size
* \param currentEv current environment object
* \param[out] width width of the block/node
* \param[out] baselineHeight distance from the bottom of the block/node-box to the baseline
* \param[out] overallHeight overall height (bottom to top) of the node, the ascent is \c overallHeight-baselineHeight
* \param[out] strikeoutPos position of the strikeout-line
*
*/
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos)=0;
JKQTMathText* parent;
bool drawBoxes;
void doDrawBoxes(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv);
@ -723,7 +735,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
public:
MTtextNode(JKQTMathText* parent, const QString& text, bool addWhitespace, bool stripInnerWhitepace=false);
virtual ~MTtextNode();
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
/*! \brief returns the property text ( \copybrief text ).
@ -734,6 +745,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
}
virtual QString getTypeName() const override ;
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
QString text;
virtual QString textTransform(const QString& text, JKQTMathText::MTenvironment currentEv, bool forSize=false);
};
@ -762,7 +775,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
MTsymbolNode(JKQTMathText* parent, const QString& name, bool addWhitespace);
virtual ~MTsymbolNode();
virtual QString getTypeName() const;
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
/*! \brief returns the property symbolName ( \copybrief symbolName ).
@ -772,6 +784,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
return this->symbolName;
}
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
/** \brief this string will be sent to the drawText method with properly set fonts */
QString symbol;
/** \brief the symbol name supplied to the constructor */
@ -797,13 +811,15 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
bool extendWidthInMathmode;
};
/** \brief subclass representing a list of nodes in the syntax tree */
/** \brief subclass representing a list of nodes in the syntax tree
*
* \image html jkqtmathtext_MTlistNode_getSizeInternal_frac.png
*/
class MTlistNode: public MTnode {
public:
MTlistNode(JKQTMathText* parent);
virtual ~MTlistNode();
virtual QString getTypeName() const;
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
void addNode(MTnode* n) { nodes.append(n); }
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
@ -815,6 +831,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
return this->nodes;
}
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
QList<MTnode*> nodes;
QSet<QString> subsupOperations;
};
@ -825,7 +843,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
MTinstruction1Node(JKQTMathText* parent, const QString& name, MTnode* child, const QStringList& parameters=QStringList());
virtual ~MTinstruction1Node();
virtual QString getTypeName() const;
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
/** \brief convert node to HTML and returns \c true on success */
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
@ -849,6 +866,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
return this->parameters;
}
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
bool setupMTenvironment(JKQTMathText::MTenvironment &ev);
MTnode* child;
@ -863,7 +882,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
public:
MTsubscriptNode(JKQTMathText* parent, MTnode* child);
virtual ~MTsubscriptNode();
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
/** \brief returns true if node is subscript or superscript node */
virtual bool isSubOrSuper() ;
@ -877,6 +895,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
virtual void setDrawBoxes(bool draw);
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
MTnode* child;
};
@ -885,7 +905,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
public:
MTsuperscriptNode(JKQTMathText* parent, MTnode* child);
virtual ~MTsuperscriptNode();
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
/** \brief returns true if node is subscript or superscript node */
virtual bool isSubOrSuper();
@ -899,6 +918,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
virtual void setDrawBoxes(bool draw);
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
MTnode* child;
};
@ -907,7 +928,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
public:
MTbraceNode(JKQTMathText* parent, const QString& openbrace, const QString& closebrace, MTnode* child, bool showRightBrace=true);
virtual ~MTbraceNode();
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
virtual void setDrawBoxes(bool draw);
@ -937,6 +957,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
return this->showRightBrace;
}
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
MTnode* child;
QString openbrace;
QString closebrace;
@ -951,7 +973,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
public:
MTsqrtNode(JKQTMathText* parent, MTnode* child, int degree=2);
virtual ~MTsqrtNode();
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
virtual void setDrawBoxes(bool draw);
@ -969,6 +990,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
return this->degree;
}
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
MTnode* child;
int degree;
};
@ -992,7 +1015,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
MTfracNode(JKQTMathText* parent, MTnode* child_top, MTnode* child_bottom, MTfracMode mode);
virtual ~MTfracNode();
virtual QString getTypeName() const ;
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
virtual void setDrawBoxes(bool draw);
@ -1015,6 +1037,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
return this->mode;
}
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
MTnode* child1;
MTnode* child2;
MTfracMode mode;
@ -1024,11 +1048,10 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
class MTmatrixNode: public MTnode {
public:
MTmatrixNode(JKQTMathText* parent, QVector<QVector<MTnode*> > children);
virtual ~MTmatrixNode();
virtual QString getTypeName() const;
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
virtual ~MTmatrixNode() override;
virtual QString getTypeName() const override;
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv) override;
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override;
/*! \brief returns the property children ( \copybrief children ).
\details Description of the parameter children is: <BLOCKQUOTE>\copydoc children </BLOCKQUOTE>.
\see children for more information */
@ -1048,6 +1071,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
return this->lines;
}
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
virtual void setDrawBoxes(bool draw);
QVector<QVector<MTnode*> > children;
int columns;
@ -1075,7 +1100,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
public:
MTdecoratedNode(JKQTMathText* parent, MTdecoration decoration, MTnode* child);
virtual ~MTdecoratedNode();
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos);
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv);
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv);
virtual void setDrawBoxes(bool draw);
@ -1093,6 +1117,8 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
return this->decoration;
}
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) override;
MTnode* child;
MTdecoration decoration;
};