diff --git a/tools/lammps-gui/flagwarnings.cpp b/tools/lammps-gui/flagwarnings.cpp index deeb9f8306..c0fb2307e2 100644 --- a/tools/lammps-gui/flagwarnings.cpp +++ b/tools/lammps-gui/flagwarnings.cpp @@ -34,6 +34,7 @@ FlagWarnings::FlagWarnings(QLabel *label, QTextDocument *parent) : document(parent) { nwarnings = nlines = 0; + oldwarnings = oldlines = -1; formatWarning.setForeground(QColorConstants::Red); formatWarning.setFontWeight(QFont::Bold); @@ -59,11 +60,15 @@ void FlagWarnings::highlightBlock(const QString &text) setFormat(match.capturedStart(1), match.capturedLength(1), formatURL); } - // update error summary label + // update error summary label when its content has changed if (document && summary) { - summary->setText( - QString("%1 Warnings / Errors - %2 Lines").arg(nwarnings).arg(document->lineCount())); - summary->repaint(); + nlines = document->lineCount(); + if ((nwarnings > oldwarnings) || (nlines > oldlines)) { + oldwarnings = nwarnings; + oldlines = nlines; + summary->setText(QString("%1 Warnings / Errors - %2 Lines").arg(nwarnings).arg(nlines)); + summary->repaint(); + } } } diff --git a/tools/lammps-gui/flagwarnings.h b/tools/lammps-gui/flagwarnings.h index b73224223b..2933ce1591 100644 --- a/tools/lammps-gui/flagwarnings.h +++ b/tools/lammps-gui/flagwarnings.h @@ -38,7 +38,7 @@ private: QTextCharFormat formatURL; QLabel *summary; QTextDocument *document; - int nwarnings, nlines; + int nwarnings, oldwarnings, nlines, oldlines; }; #endif // Local Variables: