@@ -385,9 +385,8 @@ void ResultsView::updateDetails(const QModelIndex &index)
385385 QStandardItemModel *model = qobject_cast<QStandardItemModel*>(mUI .mTree ->model ());
386386 QStandardItem *item = model->itemFromIndex (index);
387387
388- mUI .mCode ->setPlainText (QString ());
389-
390388 if (!item) {
389+ mUI .mCode ->clear ();
391390 mUI .mDetails ->setText (QString ());
392391 return ;
393392 }
@@ -400,6 +399,7 @@ void ResultsView::updateDetails(const QModelIndex &index)
400399
401400 // If there is no severity data then it is a parent item without summary and message
402401 if (!data.contains (" severity" )) {
402+ mUI .mCode ->clear ();
403403 mUI .mDetails ->setText (QString ());
404404 return ;
405405 }
@@ -425,19 +425,25 @@ void ResultsView::updateDetails(const QModelIndex &index)
425425 if (!QFileInfo (filepath).exists () && QFileInfo (mUI .mTree ->getCheckDirectory () + ' /' + filepath).exists ())
426426 filepath = mUI .mTree ->getCheckDirectory () + ' /' + filepath;
427427
428- QFile file (filepath);
429- if (file.open (QIODevice::ReadOnly | QIODevice::Text)) {
430- QStringList symbols;
431- QRegularExpression re (" .*: ([A-Za-z_][A-Za-z0-9_]*)$" );
432- const QString errorMessage = data[" message" ].toString ();
433- QRegularExpressionMatch match = re.match (errorMessage);
434- if (match.hasMatch ()) {
435- symbols << match.captured (1 );
436- }
428+ QStringList symbols;
429+ if (data.contains (" symbolNames" ))
430+ symbols = data[" symbolNames" ].toString ().split (" \n " );
437431
438- QTextStream in (&file);
439- mUI .mCode ->setError (in.readAll (), lineNumber, symbols);
432+ if (filepath == mUI .mCode ->getFileName ())
433+ {
434+ mUI .mCode ->setError (lineNumber, symbols);
435+ return ;
440436 }
437+
438+ QFile file (filepath);
439+ if (!file.open (QIODevice::ReadOnly | QIODevice::Text)) {
440+ mUI .mCode ->clear ();
441+ return ;
442+ }
443+
444+ QTextStream in (&file);
445+ mUI .mCode ->setError (in.readAll (), lineNumber, symbols);
446+ mUI .mCode ->setFileName (filepath);
441447}
442448
443449void ResultsView::log (const QString &str)
0 commit comments