From bdb08232d7ab6c7713e89c55d1e8e8caaaaccb98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 15 Jul 2020 20:55:04 +0200 Subject: [PATCH] GUI: Fix suppression of multiple cppcheck ids --- gui/resultstree.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 7233a4d15..a9202bde0 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -1047,17 +1047,24 @@ void ResultsTree::suppressCppcheckID() { if (!mSelectionModel) return; - ProjectFile *projectFile = ProjectFile::getActiveProject(); + + // Extract selected warnings + QSet selectedWarnings; foreach (QModelIndex index, mSelectionModel->selectedRows()) { QStandardItem *item = mModel.itemFromIndex(index); if (!item->parent()) continue; while (item->parent()->parent()) item = item->parent(); + selectedWarnings.insert(item); + } + + ProjectFile *projectFile = ProjectFile::getActiveProject(); + for (QStandardItem *item: selectedWarnings) { + QStandardItem *fileItem = item->parent(); const QVariantMap data = item->data().toMap(); if (projectFile && data.contains("cppcheckId")) projectFile->suppressCppcheckId(data["cppcheckId"].toULongLong()); - QStandardItem *fileItem = item->parent(); fileItem->removeRow(item->row()); if (fileItem->rowCount() == 0) mModel.removeRow(fileItem->row());