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

Method recheckSelectedFiles

gui/resultstree.cpp:922–957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

920}
921
922void ResultsTree::recheckSelectedFiles()
923{
924 if (!mSelectionModel)
925 return;
926
927 QStringList selectedItems;
928 for (const QModelIndex& index : mSelectionModel->selectedRows()) {
929 const auto *item = dynamic_cast<ResultItem*>(mModel->itemFromIndex(index));
930 while (item->parent())
931 item = dynamic_cast<const ResultItem*>(item->parent());
932 const auto e = item->getErrorPathItem();
933 const QString currentFile = e.file;
934 if (!currentFile.isEmpty()) {
935 QString fileNameWithCheckPath;
936 const QFileInfo curfileInfo(currentFile);
937 if (!curfileInfo.exists() && !mCheckPath.isEmpty() && currentFile.indexOf(mCheckPath) != 0)
938 fileNameWithCheckPath = mCheckPath + "/" + currentFile;
939 else
940 fileNameWithCheckPath = currentFile;
941 const QFileInfo fileInfo(fileNameWithCheckPath);
942 if (!fileInfo.exists()) {
943 askFileDir(currentFile);
944 return;
945 }
946 if (Path::isHeader(currentFile.toStdString())) {
947 if (!item->errorItem->file0.isEmpty() && !selectedItems.contains(item->errorItem->file0)) {
948 selectedItems << ((!mCheckPath.isEmpty() && (item->errorItem->file0.indexOf(mCheckPath) != 0)) ? (mCheckPath + "/" + item->errorItem->file0) : item->errorItem->file0);
949 if (!selectedItems.contains(fileNameWithCheckPath))
950 selectedItems << fileNameWithCheckPath;
951 }
952 } else if (!selectedItems.contains(fileNameWithCheckPath))
953 selectedItems << fileNameWithCheckPath;
954 }
955 }
956 emit checkSelected(std::move(selectedItems));
957}
958
959void ResultsTree::hideAllIdResult()
960{

Callers

nothing calls this directly

Calls 4

getErrorPathItemMethod · 0.80
isEmptyMethod · 0.80
existsMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected