From 40f2265abf1479a26ccf16afccc90a05f8a689dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 16 Nov 2009 17:09:30 +0100 Subject: [PATCH] robertreif: Fixed #442 (Filter duplicate errors in GUI) --- gui/resultstree.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 62de103a2..0380e42fc 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -104,6 +104,9 @@ void ResultsTree::AddErrorItem(const QString &file, SeverityToIcon(severity)); + if (!item) + return; + //Add user data to that item QMap data; data["severity"] = SeverityToShowType(severity); @@ -157,6 +160,27 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent, QModelIndex index = QModelIndex(); + // Check for duplicate rows and don't add them if found + for (int i = 0; i < parent->rowCount(); i++) + { + // the first column is the file name and is always the same so skip it + + // the third column is the line number so check it first + if (parent->child(i, 2)->text() == list[2]->text()) + { + // the second column is the severity so check it next + if (parent->child(i, 1)->text() == list[1]->text()) + { + // the forth column is the message so check it last + if (parent->child(i, 3)->text() == list[3]->text()) + { + // this row matches so don't add it + return 0; + } + } + } + } + parent->appendRow(list); setRowHidden(parent->rowCount() - 1, parent->index(), hide);