MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / suppressHash

Method suppressHash

gui/resultstree.cpp:1004–1036  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1002}
1003
1004void ResultsTree::suppressHash()
1005{
1006 if (!mSelectionModel)
1007 return;
1008
1009 bool changed = false;
1010 ProjectFile *projectFile = ProjectFile::getActiveProject();
1011
1012 for (QModelIndex index : mSelectionModel->selectedRows()) {
1013 auto *item = dynamic_cast<ResultItem *>(mModel->itemFromIndex(index));
1014 if (!item || item->getType() == ResultItem::Type::file)
1015 continue;
1016 if (item->getType() == ResultItem::Type::note)
1017 item = dynamic_cast<ResultItem *>(item->parent());
1018
1019 // Suppress
1020 if (projectFile && item->errorItem->hash > 0) {
1021 SuppressionList::Suppression suppression;
1022 suppression.hash = item->errorItem->hash;
1023 projectFile->addSuppression(suppression);
1024 changed = true;
1025 }
1026
1027 // Remove item
1028 QStandardItem *fileItem = item->parent();
1029 fileItem->removeRow(item->row());
1030 if (fileItem->rowCount() == 0)
1031 mModel->removeRow(fileItem->row());
1032 }
1033
1034 if (changed)
1035 projectFile->write();
1036}
1037
1038void ResultsTree::openContainingFolder()
1039{

Callers

nothing calls this directly

Calls 4

rowCountMethod · 0.80
getTypeMethod · 0.45
addSuppressionMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected