From 4462bcc3859eba07ad2bb87593c8f179df8ab085 Mon Sep 17 00:00:00 2001 From: William Jakobsson Date: Wed, 3 Jun 2026 12:22:02 +0200 Subject: [PATCH 1/2] fixed #14738 --- gui/mainwindow.cpp | 15 +++++++++++++-- gui/mainwindow.h | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 15f3e8e0665..122f80ed9c6 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -559,13 +559,24 @@ void MainWindow::saveSettings() const mUI->mResults->saveSettings(mSettings); } -void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bool checkConfig) +void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bool checkConfig, const QStringList& recheckFiles) { Settings checkSettings; auto supprs = std::make_shared(); if (!getCppcheckSettings(checkSettings, *supprs)) return; + // filter requested files + if (!recheckFiles.isEmpty()) { + std::set filesToCheck; + for (const QString& file : recheckFiles) { + filesToCheck.insert(file.toStdString()); + } + p.fileSettings.remove_if([&](const FileSettings& fs) { + return filesToCheck.find(fs.filename()) == filesToCheck.end(); + }); + } + clearResults(); mIsLogfileLoaded = false; @@ -1958,7 +1969,7 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const QStringLis msg.exec(); return; } - doAnalyzeProject(p, checkLib, checkConfig); // TODO: avoid copy + doAnalyzeProject(p, checkLib, checkConfig, recheckFiles); // TODO: avoid copy return; } diff --git a/gui/mainwindow.h b/gui/mainwindow.h index febd3a41d4c..c654a2c94f0 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -309,7 +309,7 @@ private slots: * @param checkLib Flag to indicate if library should be checked * @param checkConfig Flag to indicate if the configuration should be checked. */ - void doAnalyzeProject(ImportProject p, bool checkLib = false, bool checkConfig = false); + void doAnalyzeProject(ImportProject p, bool checkLib = false, bool checkConfig = false, const QStringList& recheckFiles = QStringList()); /** * @brief Analyze all files specified in parameter files From 881aaf9e67eb85ad53d4ed30eeddd8bec43f97cd Mon Sep 17 00:00:00 2001 From: William Jakobsson Date: Wed, 3 Jun 2026 14:22:44 +0200 Subject: [PATCH 2/2] fix --- gui/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 122f80ed9c6..3fd4d702a76 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -568,12 +568,12 @@ void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bo // filter requested files if (!recheckFiles.isEmpty()) { - std::set filesToCheck; + QSet filesToCheck; for (const QString& file : recheckFiles) { - filesToCheck.insert(file.toStdString()); + filesToCheck.insert(file); } p.fileSettings.remove_if([&](const FileSettings& fs) { - return filesToCheck.find(fs.filename()) == filesToCheck.end(); + return !filesToCheck.contains(QString::fromStdString(fs.filename())); }); }