Skip to content

Commit cafcfee

Browse files
committed
use set for duplicate check in results tree
1 parent 8ac514a commit cafcfee

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎gui/resultstree.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ bool ResultsTree::addErrorItem(const ErrorItem& errorItem)
246246
const QString s = errorItem.toString();
247247
if (mErrorList.contains(s))
248248
return false;
249-
mErrorList.append(s);
249+
mErrorList.insert(s);
250250

251251
QSharedPointer<ErrorItem> errorItemPtr{new ErrorItem(errorItem)};
252252

@@ -1137,7 +1137,7 @@ void ResultsTree::removeFileErrorsFromErrorList(const ResultItem *fileItem)
11371137
for (int i{0}; i < fileItem->rowCount(); ++i) {
11381138
const auto *errorItem = dynamic_cast<const ResultItem*>(fileItem->child(i, COLUMN_FILE));
11391139
if (errorItem && errorItem->errorItem)
1140-
mErrorList.removeAll(errorItem->errorItem->toString());
1140+
mErrorList.remove(errorItem->errorItem->toString());
11411141
}
11421142
}
11431143

‎gui/resultstree.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <string>
3030

3131
#include <QObject>
32+
#include <QSet>
3233
#include <QString>
3334
#include <QStringList>
3435
#include <QTreeView>
@@ -572,8 +573,8 @@ protected slots:
572573

573574
QStringList mHiddenMessageId;
574575

575-
// List of existing errors so we can avoid duplicates
576-
QStringList mErrorList;
576+
// Set of existing errors so we can avoid duplicates
577+
QSet<QString> mErrorList;
577578

578579
QItemSelectionModel* mSelectionModel{};
579580
ThreadHandler *mThread{};

0 commit comments

Comments
 (0)