removed compiler warning

This commit is contained in:
jkriege2 2019-05-01 14:58:19 +02:00
parent f710048f49
commit 171f1e6274
2 changed files with 30 additions and 30 deletions

View File

@ -232,11 +232,11 @@ void JKQTMathText::MTnode::doDrawBoxes(QPainter& painter, double x, double y, JK
if (w>0) painter.drawLine(QLineF(x, y, x+w, y)); if (w>0) painter.drawLine(QLineF(x, y, x+w, y));
p.setColor("green"); p.setColor("green");
painter.setPen(p); painter.setPen(p);
painter.drawEllipse(x-3.0,y-3.0,6.0,6.0); painter.drawEllipse(QRectF(x-3.0,y-3.0,6.0,6.0));
p.setColor("lightgreen"); p.setColor("lightgreen");
painter.setPen(p); painter.setPen(p);
painter.drawLine(x-2.0, y, x+2.0, y); painter.drawLine(QLineF(x-2.0, y, x+2.0, y));
painter.drawLine(x, y-2, x, y+2.0); painter.drawLine(QLineF(x, y-2, x, y+2.0));
} }
} }
@ -265,7 +265,7 @@ JKQTMathText::MTtextNode::MTtextNode(JKQTMathText* parent, const QString& textIn
JKQTMathText::MTtextNode::~MTtextNode() = default; JKQTMathText::MTtextNode::~MTtextNode() = default;
void JKQTMathText::MTtextNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* prevNodeSize) { void JKQTMathText::MTtextNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* /*prevNodeSize*/) {
QFont f=currentEv.getFont(parent); QFont f=currentEv.getFont(parent);
if (currentEv.insideMath && (text=="(" || text=="[" || text=="|" || text=="]" || text==")" || text=="<" || text==">" || if (currentEv.insideMath && (text=="(" || text=="[" || text=="|" || text=="]" || text==")" || text=="<" || text==">" ||
text==QString(QChar(0x2329)) || text==QString(QChar(0x232A)) || text==QString(QChar(0x2308)) || text==QString(QChar(0x2329)) || text==QString(QChar(0x232A)) || text==QString(QChar(0x2308)) ||
@ -279,7 +279,7 @@ void JKQTMathText::MTtextNode::getSizeInternal(QPainter& painter, JKQTMathText::
QRectF tbr=parent->getTightBoundingRect(f, txt, painter.device()); //fm.tightBoundingRect(txt); QRectF tbr=parent->getTightBoundingRect(f, txt, painter.device()); //fm.tightBoundingRect(txt);
if (txt=="|") { if (txt=="|") {
br=fm.boundingRect("X"); br=fm.boundingRect("X");
tbr=QRect(0,0,fm.width("X"), fm.ascent());//fm.boundingRect("X"); tbr=QRectF(0,0,fm.width("X"), fm.ascent());//fm.boundingRect("X");
br.setWidth(0.7*br.width()); br.setWidth(0.7*br.width());
} }
width=br.width();//width(text); width=br.width();//width(text);
@ -295,7 +295,7 @@ void JKQTMathText::MTtextNode::getSizeInternal(QPainter& painter, JKQTMathText::
strikeoutPos=fm.strikeOutPos()*1.1; strikeoutPos=fm.strikeOutPos()*1.1;
} }
double JKQTMathText::MTtextNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* prevNodeSize) { double JKQTMathText::MTtextNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* /*prevNodeSize*/) {
doDrawBoxes(painter, x, y, currentEv); doDrawBoxes(painter, x, y, currentEv);
double width=0; double width=0;
double baselineHeight=0; double baselineHeight=0;
@ -455,7 +455,7 @@ QString JKQTMathText::MTinstruction1Node::getTypeName() const
return QLatin1String("MTinstruction1Node(")+name+")"; return QLatin1String("MTinstruction1Node(")+name+")";
} }
void JKQTMathText::MTinstruction1Node::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* prevNodeSize) { void JKQTMathText::MTinstruction1Node::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* /*prevNodeSize*/) {
JKQTMathText::MTenvironment ev=currentEv; JKQTMathText::MTenvironment ev=currentEv;
setupMTenvironment(ev); setupMTenvironment(ev);
@ -470,7 +470,7 @@ void JKQTMathText::MTinstruction1Node::getSizeInternal(QPainter& painter, JKQTMa
} }
} }
double JKQTMathText::MTinstruction1Node::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* prevNodeSize) { double JKQTMathText::MTinstruction1Node::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* /*prevNodeSize*/) {
doDrawBoxes(painter, x, y, currentEv); doDrawBoxes(painter, x, y, currentEv);
JKQTMathText::MTenvironment ev=currentEv; JKQTMathText::MTenvironment ev=currentEv;
@ -489,7 +489,7 @@ double JKQTMathText::MTinstruction1Node::draw(QPainter& painter, double x, doubl
double xw=fm.width("x"); double xw=fm.width("x");
p.setColor(fcol); p.setColor(fcol);
painter.setPen(p); painter.setPen(p);
painter.drawRect(x,y-baselineHeight-xw/2,width+xw,overallHeight+xw); painter.drawRect(QRectF(x,y-baselineHeight-xw/2,width+xw,overallHeight+xw));
shiftX=xw/2.0; shiftX=xw/2.0;
} }
@ -634,7 +634,7 @@ JKQTMathText::MTsqrtNode::~MTsqrtNode() {
if (child!=nullptr) delete child; if (child!=nullptr) delete child;
} }
void JKQTMathText::MTsqrtNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* prevNodeSize) { void JKQTMathText::MTsqrtNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* /*prevNodeSize*/) {
QFontMetricsF fm(currentEv.getFont(parent), painter.device()); QFontMetricsF fm(currentEv.getFont(parent), painter.device());
child->getSize(painter, currentEv, width, baselineHeight, overallHeight, strikeoutPos); child->getSize(painter, currentEv, width, baselineHeight, overallHeight, strikeoutPos);
@ -644,7 +644,7 @@ void JKQTMathText::MTsqrtNode::getSizeInternal(QPainter& painter, JKQTMathText::
width=width+fm.boundingRect("A").width()*2; // 1.53 width=width+fm.boundingRect("A").width()*2; // 1.53
} }
double JKQTMathText::MTsqrtNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* prevNodeSize) { double JKQTMathText::MTsqrtNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* /*prevNodeSize*/) {
doDrawBoxes(painter, x, y, currentEv); doDrawBoxes(painter, x, y, currentEv);
double width=0, baselineHeight=0, overallHeight=0, sp=0; double width=0, baselineHeight=0, overallHeight=0, sp=0;
child->getSize(painter, currentEv, width, baselineHeight, overallHeight, sp); child->getSize(painter, currentEv, width, baselineHeight, overallHeight, sp);
@ -727,7 +727,7 @@ QString JKQTMathText::MTfracNode::getTypeName() const
return "MTfracNode"; return "MTfracNode";
} }
void JKQTMathText::MTfracNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* prevNodeSize) { void JKQTMathText::MTfracNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* /*prevNodeSize*/) {
QFontMetricsF fm(currentEv.getFont(parent), painter.device()); QFontMetricsF fm(currentEv.getFont(parent), painter.device());
JKQTMathText::MTenvironment ev1=currentEv; JKQTMathText::MTenvironment ev1=currentEv;
JKQTMathText::MTenvironment ev2=currentEv; JKQTMathText::MTenvironment ev2=currentEv;
@ -799,7 +799,7 @@ void JKQTMathText::MTfracNode::getSizeInternal(QPainter& painter, JKQTMathText::
} }
} }
double JKQTMathText::MTfracNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* prevNodeSize) { double JKQTMathText::MTfracNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* /*prevNodeSize*/) {
doDrawBoxes(painter, x, y, currentEv); doDrawBoxes(painter, x, y, currentEv);
QFont f=currentEv.getFont(parent); QFont f=currentEv.getFont(parent);
QFontMetricsF fm(f, painter.device()); QFontMetricsF fm(f, painter.device());
@ -938,7 +938,7 @@ QString JKQTMathText::MTmatrixNode::getTypeName() const
return "MTmatrixNode"; return "MTmatrixNode";
} }
void JKQTMathText::MTmatrixNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* prevNodeSize) { void JKQTMathText::MTmatrixNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* /*prevNodeSize*/) {
QFontMetricsF fm(currentEv.getFont(parent), painter.device()); QFontMetricsF fm(currentEv.getFont(parent), painter.device());
JKQTMathText::MTenvironment ev1=currentEv; JKQTMathText::MTenvironment ev1=currentEv;
@ -980,7 +980,7 @@ void JKQTMathText::MTmatrixNode::getSizeInternal(QPainter& painter, JKQTMathText
strikeoutPos=xh; strikeoutPos=xh;
} }
double JKQTMathText::MTmatrixNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* prevNodeSize) { double JKQTMathText::MTmatrixNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* /*prevNodeSize*/) {
doDrawBoxes(painter, x, y, currentEv); doDrawBoxes(painter, x, y, currentEv);
QFontMetricsF fm(currentEv.getFont(parent), painter.device()); QFontMetricsF fm(currentEv.getFont(parent), painter.device());
@ -1075,7 +1075,7 @@ JKQTMathText::MTdecoratedNode::~MTdecoratedNode() {
if (child!=nullptr) delete child; if (child!=nullptr) delete child;
} }
void JKQTMathText::MTdecoratedNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* prevNodeSize) { void JKQTMathText::MTdecoratedNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* /*prevNodeSize*/) {
QFontMetricsF fm(currentEv.getFont(parent), painter.device()); QFontMetricsF fm(currentEv.getFont(parent), painter.device());
double wc=fm.boundingRect("A").width(); double wc=fm.boundingRect("A").width();
double dheightfactor=1.0+parent->getDecorationHeightFactor()*2.0; double dheightfactor=1.0+parent->getDecorationHeightFactor()*2.0;
@ -1087,7 +1087,7 @@ void JKQTMathText::MTdecoratedNode::getSizeInternal(QPainter& painter, JKQTMathT
width=width+0.3*wc; width=width+0.3*wc;
} }
double JKQTMathText::MTdecoratedNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* prevNodeSize) { double JKQTMathText::MTdecoratedNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* /*prevNodeSize*/) {
doDrawBoxes(painter, x, y, currentEv); doDrawBoxes(painter, x, y, currentEv);
MTenvironment ev=currentEv; MTenvironment ev=currentEv;
double width=0, baselineHeight=0, overallHeight=0, strikeoutPos=0; double width=0, baselineHeight=0, overallHeight=0, strikeoutPos=0;
@ -1316,7 +1316,7 @@ JKQTMathText::MTbraceNode::~MTbraceNode() {
if (child!=nullptr) delete child; if (child!=nullptr) delete child;
} }
void JKQTMathText::MTbraceNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* prevNodeSize) { void JKQTMathText::MTbraceNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* /*prevNodeSize*/) {
JKQTMathText::MTenvironment ev=currentEv; JKQTMathText::MTenvironment ev=currentEv;
child->getSize(painter, currentEv, width, baselineHeight, overallHeight, strikeoutPos); child->getSize(painter, currentEv, width, baselineHeight, overallHeight, strikeoutPos);
@ -1334,7 +1334,7 @@ void JKQTMathText::MTbraceNode::getSizeInternal(QPainter& painter, JKQTMathText:
} }
double JKQTMathText::MTbraceNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* prevNodeSize) { double JKQTMathText::MTbraceNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* /*prevNodeSize*/) {
//std::cout<<"drawing brace-node: '"<<openbrace.toStdString()<<"' ... '"<<closebrace.toStdString()<<"'\n"; //std::cout<<"drawing brace-node: '"<<openbrace.toStdString()<<"' ... '"<<closebrace.toStdString()<<"'\n";
doDrawBoxes(painter, x, y, currentEv); doDrawBoxes(painter, x, y, currentEv);
JKQTMathText::MTenvironment ev=currentEv; JKQTMathText::MTenvironment ev=currentEv;
@ -1590,13 +1590,13 @@ QString JKQTMathText::MTlistNode::getTypeName() const
return "MTlistNode"; return "MTlistNode";
} }
void JKQTMathText::MTlistNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* prevNodeSize) { void JKQTMathText::MTlistNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* /*prevNodeSize*/) {
width=0; width=0;
overallHeight=0; overallHeight=0;
baselineHeight=0; baselineHeight=0;
strikeoutPos=0; strikeoutPos=0;
QFontMetricsF fm(currentEv.getFont(parent)); QFontMetricsF fm(currentEv.getFont(parent));
QRectF tbr=parent->getTightBoundingRect(currentEv.getFont(parent), "M", painter.device()); //QRectF tbr=parent->getTightBoundingRect(currentEv.getFont(parent), "M", painter.device());
double xnew=0; double xnew=0;
@ -1803,7 +1803,7 @@ void JKQTMathText::MTlistNode::getSizeInternal(QPainter& painter, JKQTMathText::
width=xnew; width=xnew;
} }
double JKQTMathText::MTlistNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* prevNodeSize) { double JKQTMathText::MTlistNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* /*prevNodeSize*/) {
doDrawBoxes(painter, x, y, currentEv); doDrawBoxes(painter, x, y, currentEv);
double ynew=y; double ynew=y;
double xnew=x; double xnew=x;
@ -2785,7 +2785,7 @@ QFont JKQTMathText::MTsymbolNode::getFontName(symbolFont f, QFont& fi) const {
return fr; return fr;
} }
void JKQTMathText::MTsymbolNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* prevNodeSize) { void JKQTMathText::MTsymbolNode::getSizeInternal(QPainter& painter, JKQTMathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* /*prevNodeSize*/) {
QFont f=currentEv.getFont(parent); QFont f=currentEv.getFont(parent);
f=getFontName(font, f); f=getFontName(font, f);
f.setPointSizeF(f.pointSizeF()*fontFactor); f.setPointSizeF(f.pointSizeF()*fontFactor);
@ -2837,7 +2837,7 @@ void JKQTMathText::MTsymbolNode::getSizeInternal(QPainter& painter, JKQTMathText
} }
double JKQTMathText::MTsymbolNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* prevNodeSize) { double JKQTMathText::MTsymbolNode::draw(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv, const MTnodeSize* /*prevNodeSize*/) {
doDrawBoxes(painter, x, y, currentEv); doDrawBoxes(painter, x, y, currentEv);
double width=0; double width=0;
double baselineHeight=0; double baselineHeight=0;
@ -4166,7 +4166,7 @@ void JKQTMathText::draw(QPainter& painter, double x, double y, bool drawBoxes){
} }
} }
void JKQTMathText::draw(QPainter& painter, int flags, QRectF rect, bool drawBoxes) { void JKQTMathText::draw(QPainter& painter, unsigned int flags, QRectF rect, bool drawBoxes) {
if (getTree()!=nullptr) { if (getTree()!=nullptr) {
MTenvironment ev; MTenvironment ev;
ev.color=fontColor; ev.color=fontColor;
@ -4331,7 +4331,7 @@ void JKQTMathTextLabel::internalPaint()
size=m_mathText->getSize(p); size=m_mathText->getSize(p);
p.end(); p.end();
} }
buffer=QPixmap(qMax(32.0,size.width()*1.2), qMax(10.0,size.height()*1.1)); buffer=QPixmap(static_cast<int>(qMax(32.0,size.width()*1.2)), static_cast<int>(qMax(10.0,size.height()*1.1)));
buffer.fill(Qt::transparent); buffer.fill(Qt::transparent);
{ {
//qDebug()<<"internalPaint(): "<<buffer.size()<<size; //qDebug()<<"internalPaint(): "<<buffer.size()<<size;

View File

@ -246,7 +246,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
* *
* This version draws the text inside the given rectangle according to the specified flags. * This version draws the text inside the given rectangle according to the specified flags.
*/ */
void draw(QPainter& painter, int flags, QRectF rect, bool drawBoxes=false); void draw(QPainter& painter, unsigned int flags, QRectF rect, bool drawBoxes=false);
/** \brief configures the class to use the STIX fonts in mathmode /** \brief configures the class to use the STIX fonts in mathmode
* *
@ -1054,7 +1054,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override; virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override;
/** \copydoc MTnode::setDrawBoxes() */ /** \copydoc MTnode::setDrawBoxes() */
virtual void setDrawBoxes(bool draw) override; virtual void setDrawBoxes(bool draw) override;
virtual QString getTypeName() const ; virtual QString getTypeName() const override ;
/*! \brief returns the child node */ /*! \brief returns the child node */
inline MTnode* getChild() const { inline MTnode* getChild() const {
return this->child; return this->child;
@ -1090,7 +1090,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
public: public:
MTfracNode(JKQTMathText* parent, MTnode* child_top, MTnode* child_bottom, MTfracMode mode); MTfracNode(JKQTMathText* parent, MTnode* child_top, MTnode* child_bottom, MTfracMode mode);
virtual ~MTfracNode() override; virtual ~MTfracNode() override;
virtual QString getTypeName() const ; virtual QString getTypeName() const override;
/** \copydoc MTnode::draw() */ /** \copydoc MTnode::draw() */
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv, const MTnodeSize* prevNodeSize=nullptr) override; virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv, const MTnodeSize* prevNodeSize=nullptr) override;
/** \copydoc MTnode::toHtml() */ /** \copydoc MTnode::toHtml() */
@ -1181,7 +1181,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override; virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override;
/** \copydoc MTnode::setDrawBoxes() */ /** \copydoc MTnode::setDrawBoxes() */
virtual void setDrawBoxes(bool draw) override; virtual void setDrawBoxes(bool draw) override;
virtual QString getTypeName() const ; virtual QString getTypeName() const override ;
/*! \brief returns the child node */ /*! \brief returns the child node */
inline MTnode* getChild() const { inline MTnode* getChild() const {
return this->child; return this->child;