GUI: Fix suppression of multiple cppcheck ids
This commit is contained in:
parent
4f83b3618c
commit
bdb08232d7
|
@ -1047,17 +1047,24 @@ void ResultsTree::suppressCppcheckID()
|
||||||
{
|
{
|
||||||
if (!mSelectionModel)
|
if (!mSelectionModel)
|
||||||
return;
|
return;
|
||||||
ProjectFile *projectFile = ProjectFile::getActiveProject();
|
|
||||||
|
// Extract selected warnings
|
||||||
|
QSet<QStandardItem *> selectedWarnings;
|
||||||
foreach (QModelIndex index, mSelectionModel->selectedRows()) {
|
foreach (QModelIndex index, mSelectionModel->selectedRows()) {
|
||||||
QStandardItem *item = mModel.itemFromIndex(index);
|
QStandardItem *item = mModel.itemFromIndex(index);
|
||||||
if (!item->parent())
|
if (!item->parent())
|
||||||
continue;
|
continue;
|
||||||
while (item->parent()->parent())
|
while (item->parent()->parent())
|
||||||
item = item->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();
|
const QVariantMap data = item->data().toMap();
|
||||||
if (projectFile && data.contains("cppcheckId"))
|
if (projectFile && data.contains("cppcheckId"))
|
||||||
projectFile->suppressCppcheckId(data["cppcheckId"].toULongLong());
|
projectFile->suppressCppcheckId(data["cppcheckId"].toULongLong());
|
||||||
QStandardItem *fileItem = item->parent();
|
|
||||||
fileItem->removeRow(item->row());
|
fileItem->removeRow(item->row());
|
||||||
if (fileItem->rowCount() == 0)
|
if (fileItem->rowCount() == 0)
|
||||||
mModel.removeRow(fileItem->row());
|
mModel.removeRow(fileItem->row());
|
||||||
|
|
Loading…
Reference in New Issue