From b83d0cb87959b8aad4a1a9a73480936636c74477 Mon Sep 17 00:00:00 2001 From: kriegerj Date: Tue, 1 Sep 2015 12:43:04 +0200 Subject: [PATCH] JKQTMathTextLabel now works better (use JKQTMathTextLabel::setMath() !!!) --- jkqtmathtext.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/jkqtmathtext.cpp b/jkqtmathtext.cpp index 84cff88e42..780d5dcf48 100644 --- a/jkqtmathtext.cpp +++ b/jkqtmathtext.cpp @@ -24,6 +24,7 @@ #include #include #include +#include //#define QColor2String(color) QString(jkqtp_rgbtostring((color).red(), (color).green(), (color).blue(), (color).alpha()).c_str()) @@ -4053,7 +4054,8 @@ void JKQTMathTextLabel::setMath(const QString &text, bool doRepaint) if (text!=lastText || doRepaint){ lastText=text; repaintDo=true; - repaint(); + internalPaint(); + update(); } } @@ -4062,12 +4064,16 @@ void JKQTMathTextLabel::internalPaint() { //return; //qDebug()<<"internalPaint "<parse(lastText)<<"\n "<get_error_list().join("\n")<<"\n\n"; - if (buffer.width()<=0 || buffer.height()<=0) buffer=QPixmap(100,100); + if (!m_mathText->parse(lastText)) { + qDebug()<<"JKQTMathTextLabel::internalPaint(): parse '"<parse(lastText)<<"\n "<get_error_list().join("\n")<<"\n\n"; + } + + if (buffer.width()<=0 || buffer.height()<=0) buffer=QPixmap(1000,100); //qDebug()<<"internalPaint(): buffer "<draw(p,alignment(), QRectF(QPointF(0,0), size)); p.end(); } - } + setPixmap(buffer); + //} + //qDebug()<<"internalPaint(): setPixmap"; + QApplication::processEvents(); + //qDebug()<<"internalPaint(): DONE"; } void JKQTMathTextLabel::paintEvent(QPaintEvent *event) { //QLabel::paintEvent(event); //return; - internalPaint(); + //qDebug()<<"paintEvent: "<