@@ -134,7 +134,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
134134 line.severity = item.severity ;
135135 // Create the base item for the error and ensure it has a proper
136136 // file item as a parent
137- QStandardItem *stditem = AddBacktraceFiles (EnsureFileItem (line.file , hide),
137+ QStandardItem *stditem = AddBacktraceFiles (EnsureFileItem (line.file , item. file0 , hide),
138138 line,
139139 hide,
140140 SeverityToIcon (line.severity ));
@@ -152,6 +152,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
152152 data[" line" ] = item.lines [0 ];
153153 data[" id" ] = item.errorId ;
154154 data[" inconclusive" ] = item.inconclusive ;
155+ data[" file0" ] = item.file0 ;
155156 stditem->setData (QVariant (data));
156157
157158 // Add backtrace files as children
@@ -303,6 +304,25 @@ void ResultsTree::Clear()
303304 mModel .removeRows (0 , mModel .rowCount ());
304305}
305306
307+ void ResultsTree::Clear (const QString &filename)
308+ {
309+ const QString stripped = StripPath (filename, false );
310+
311+ for (int i = 0 ; i < mModel .rowCount (); ++i) {
312+ const QStandardItem *item = mModel .item (i, 0 );
313+ if (!item)
314+ continue ;
315+
316+ QVariantMap data = item->data ().toMap ();
317+ if (stripped == data[" file" ].toString () ||
318+ filename == data[" file0" ].toString ()) {
319+ mModel .removeRow (i);
320+ break ;
321+ }
322+ }
323+ }
324+
325+
306326void ResultsTree::LoadSettings ()
307327{
308328 for (int i = 0 ; i < mModel .columnCount (); i++) {
@@ -433,7 +453,7 @@ void ResultsTree::RefreshTree()
433453 }
434454}
435455
436- QStandardItem *ResultsTree::EnsureFileItem (const QString &fullpath, bool hide)
456+ QStandardItem *ResultsTree::EnsureFileItem (const QString &fullpath, const QString &file0, bool hide)
437457{
438458 QString name = StripPath (fullpath, false );
439459 // Since item has path with native separators we must use path with
@@ -452,6 +472,7 @@ QStandardItem *ResultsTree::EnsureFileItem(const QString &fullpath, bool hide)
452472 // Add user data to that item
453473 QMap<QString, QVariant> data;
454474 data[" file" ] = fullpath;
475+ data[" file0" ] = file0;
455476 item->setData (QVariant (data));
456477 mModel .appendRow (item);
457478
@@ -828,6 +849,7 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item)
828849 item.message = data[" message" ].toString ();
829850 item.errorId = data[" id" ].toString ();
830851 item.inconclusive = data[" inconclusive" ].toBool ();
852+ item.file0 = data[" file0" ].toString ();
831853 QString file = StripPath (data[" file" ].toString (), true );
832854 unsigned int line = data[" line" ].toUInt ();
833855
0 commit comments