From e3b20b37e4e929344890e2db87683926373aef30 Mon Sep 17 00:00:00 2001 From: William Jakobsson Date: Wed, 3 Jun 2026 12:22:02 +0200 Subject: [PATCH 1/3] 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 57cec0bbc0dc68ccc1fc8c60f3ffd758316899cf Mon Sep 17 00:00:00 2001 From: William Jakobsson Date: Wed, 3 Jun 2026 14:22:44 +0200 Subject: [PATCH 2/3] 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())); }); } From 048ef463f1ea5882b7279820d342eb8a460c31f2 Mon Sep 17 00:00:00 2001 From: William Jakobsson Date: Thu, 4 Jun 2026 09:14:26 +0200 Subject: [PATCH 3/3] improve --- gui/mainwindow.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 3fd4d702a76..bf73828bed4 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -568,12 +568,8 @@ void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bo // filter requested files if (!recheckFiles.isEmpty()) { - QSet filesToCheck; - for (const QString& file : recheckFiles) { - filesToCheck.insert(file); - } p.fileSettings.remove_if([&](const FileSettings& fs) { - return !filesToCheck.contains(QString::fromStdString(fs.filename())); + return !recheckFiles.contains(QString::fromStdString(fs.filename())); }); }