From 189e09a1a715dde5f8509ae548ff65f7eea623b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 7 Sep 2026 18:23:30 +0200 Subject: [PATCH 1/2] Fix #14829 (Platform configuration mismatch between UI selection and analysis log) --- gui/mainwindow.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 31f124bc5b0..22d9f30d06f 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -584,7 +584,7 @@ void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bo }); p.ignorePaths(v); - if (!mProjectFile->getAnalyzeAllVsConfigs()) { + if (checkSettings.platform.type == Platform::Native && !mProjectFile->getAnalyzeAllVsConfigs()) { const Platform::Type platform = static_cast(mSettings->value(SETTINGS_CHECKED_PLATFORM, 0).toInt()); std::vector configurations; const QStringList configs = mProjectFile->getVsConfigurations(); @@ -1155,10 +1155,9 @@ bool MainWindow::getCppcheckSettings(Settings& settings, Suppressions& supprs) const QString platform = mProjectFile->getPlatform(); if (platform.endsWith(".xml")) { - const std::vector paths = { - Path::getCurrentPath(), // TODO: do we want to look in CWD? - QCoreApplication::applicationFilePath().toStdString(), - }; + std::vector paths; + for (const QString& p: mProjectFile->getSearchPaths("platform")) + paths.emplace_back(p.toStdString()); settings.platform.loadFromFile(paths, platform.toStdString()); } else { for (int i = Platform::Type::Native; i <= Platform::Type::Unix64; i++) { From c0e9291a8c1ea8eca2e3232f3699fb87f729e452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 8 Sep 2026 09:36:09 +0200 Subject: [PATCH 2/2] refactor --- gui/mainwindow.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 22d9f30d06f..daebd8cc995 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -118,6 +118,15 @@ static QString fromNativePath(const QString& p) { #endif } +template> +static T toStdStringList(const QStringList& stringList) { + T ret; + std::transform(stringList.cbegin(), stringList.cend(), std::back_inserter(ret), [](const QString& s) { + return s.toStdString(); + }); + return ret; +} + MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : mSettings(settings), mApplications(new ApplicationList(this)), @@ -697,10 +706,7 @@ void MainWindow::doAnalyzeFiles(const QStringList &files, const bool checkLib, c if (!checkSettings.buildDir.empty()) { checkSettings.loadSummaries(); - std::list sourcefiles; - std::transform(fileNames.cbegin(), fileNames.cend(), std::back_inserter(sourcefiles), [](const QString& s) { - return s.toStdString(); - }); + const std::list sourcefiles = toStdStringList>(fileNames); AnalyzerInformation::writeFilesTxt(checkSettings.buildDir, sourcefiles, {}); } @@ -1155,9 +1161,7 @@ bool MainWindow::getCppcheckSettings(Settings& settings, Suppressions& supprs) const QString platform = mProjectFile->getPlatform(); if (platform.endsWith(".xml")) { - std::vector paths; - for (const QString& p: mProjectFile->getSearchPaths("platform")) - paths.emplace_back(p.toStdString()); + const std::vector paths = toStdStringList(mProjectFile->getSearchPaths("platform")); settings.platform.loadFromFile(paths, platform.toStdString()); } else { for (int i = Platform::Type::Native; i <= Platform::Type::Unix64; i++) {