@@ -132,6 +132,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
132132
133133 // Add user data to that item
134134 QMap<QString, QVariant> data;
135+ data[" hide" ] = false ;
135136 data[" severity" ] = SeverityToShowType (item.severity );
136137 data[" summary" ] = item.summary ;
137138 data[" message" ] = item.message ;
@@ -313,6 +314,35 @@ void ResultsTree::ShowResults(ShowTypes type, bool show)
313314 }
314315}
315316
317+ void ResultsTree::ShowHiddenResults ()
318+ {
319+ // Clear the "hide" flag for each item
320+ int filecount = mModel .rowCount ();
321+ for (int i = 0 ; i < filecount; i++)
322+ {
323+ QStandardItem *file = mModel .item (i, 0 );
324+ if (!file)
325+ continue ;
326+
327+ QVariantMap data = file->data ().toMap ();
328+ data[" hide" ] = false ;
329+ file->setData (QVariant (data));
330+
331+ int errorcount = file->rowCount ();
332+ for (int j = 0 ; j < errorcount; j++)
333+ {
334+ QStandardItem *child = file->child (j, 0 );
335+ if (child)
336+ {
337+ data = child->data ().toMap ();
338+ data[" hide" ] = false ;
339+ child->setData (QVariant (data));
340+ }
341+ }
342+ }
343+ RefreshTree ();
344+ }
345+
316346
317347void ResultsTree::RefreshTree ()
318348{
@@ -350,7 +380,7 @@ void ResultsTree::RefreshTree()
350380 QVariantMap data = userdata.toMap ();
351381
352382 // Check if this error should be hidden
353- bool hide = !mShowTypes [VariantToShowType (data[" severity" ])];
383+ bool hide = (data[ " hide " ]. toBool () || !mShowTypes [VariantToShowType (data[" severity" ])]) ;
354384
355385 if (!hide)
356386 {
@@ -367,6 +397,12 @@ void ResultsTree::RefreshTree()
367397 }
368398 }
369399
400+ // Hide the file if its "hide" attribute is set
401+ if (file->data ().toMap ()[" hide" ].toBool ())
402+ {
403+ show = false ;
404+ }
405+
370406 // Show the file if any of it's errors are visible
371407 setRowHidden (i, QModelIndex (), !show);
372408 }
@@ -463,14 +499,17 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
463499 QAction *copyfilename = new QAction (tr (" Copy filename" ), &menu);
464500 QAction *copypath = new QAction (tr (" Copy full path" ), &menu);
465501 QAction *copymessage = new QAction (tr (" Copy message" ), &menu);
502+ QAction *hide = new QAction (tr (" Hide" ), &menu);
466503
467504 menu.addAction (copyfilename);
468505 menu.addAction (copypath);
469506 menu.addAction (copymessage);
507+ menu.addAction (hide);
470508
471509 connect (copyfilename, SIGNAL (triggered ()), this , SLOT (CopyFilename ()));
472510 connect (copypath, SIGNAL (triggered ()), this , SLOT (CopyFullPath ()));
473511 connect (copymessage, SIGNAL (triggered ()), this , SLOT (CopyMessage ()));
512+ connect (hide, SIGNAL (triggered ()), this , SLOT (HideResult ()));
474513 }
475514
476515 // Start the menu
@@ -621,6 +660,19 @@ void ResultsTree::CopyMessage()
621660 }
622661}
623662
663+ void ResultsTree::HideResult ()
664+ {
665+ if (mContextItem )
666+ {
667+ // Set the "hide" flag for this item
668+ QVariantMap data = mContextItem ->data ().toMap ();
669+ data[" hide" ] = true ;
670+ mContextItem ->setData (QVariant (data));
671+
672+ RefreshTree ();
673+ }
674+ }
675+
624676void ResultsTree::Context (int application)
625677{
626678 StartApplication (mContextItem , application);
0 commit comments