Skip to content

Commit 816b7ac

Browse files
committed
selfcheck
1 parent 77f3e30 commit 816b7ac

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

gui/resultstree.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ void ResultsTree::hideResult()
935935
if (!mSelectionModel)
936936
return;
937937
bool hide = false;
938-
for (QModelIndex index : mSelectionModel->selectedRows()) {
938+
for (const QModelIndex& index : mSelectionModel->selectedRows()) {
939939
ResultItem *item = dynamic_cast<ResultItem*>(mModel->itemFromIndex(index));
940940
if (item && item->getType() == ResultItem::Type::message)
941941
hide = item->hidden = true;
@@ -952,7 +952,7 @@ void ResultsTree::recheckSelectedFiles()
952952
return;
953953

954954
QStringList selectedItems;
955-
for (QModelIndex index : mSelectionModel->selectedRows()) {
955+
for (const QModelIndex& index : mSelectionModel->selectedRows()) {
956956
const ResultItem *item = dynamic_cast<ResultItem*>(mModel->itemFromIndex(index));
957957
while (item->parent())
958958
item = dynamic_cast<const ResultItem*>(item->parent());
@@ -1000,7 +1000,7 @@ void ResultsTree::suppressSelectedIds()
10001000
return;
10011001

10021002
QSet<QString> selectedIds;
1003-
for (QModelIndex index : mSelectionModel->selectedRows()) {
1003+
for (const QModelIndex& index : mSelectionModel->selectedRows()) {
10041004
const ResultItem *item = dynamic_cast<ResultItem*>(mModel->itemFromIndex(index));
10051005
if (!item || item->getType() == ResultItem::Type::file || !item->errorItem)
10061006
continue;
@@ -1178,13 +1178,12 @@ void ResultsTree::updateFromOldReport(const QString &filename)
11781178
if (!error)
11791179
// FIXME..
11801180
continue;
1181-
const ErrorItem* oldError = nullptr;
1182-
for (const ErrorItem& err: oldErrors) {
1183-
if (ErrorItem::same(err, *error->errorItem)) {
1184-
oldError = &err;
1185-
break;
1186-
}
1187-
}
1181+
const auto it = std::find_if(oldErrors.cbegin(),
1182+
oldErrors.cend(),
1183+
[error](const ErrorItem& err) {
1184+
return ErrorItem::same(err, *error->errorItem);
1185+
});
1186+
const ErrorItem* oldError = (it == oldErrors.cend()) ? nullptr : &*it;
11881187

11891188
// New error .. set the "sinceDate" property
11901189
if (oldError && !oldError->sinceDate.isEmpty()) {

0 commit comments

Comments
 (0)