From c76083679611ac0dabe5fda0109215a420b568f3 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 19 Dec 2024 11:14:31 +0100 Subject: [PATCH] ClangTools: Fix stringification of check names The BaseChecksTreeModel class abuses a FilePath-based base class for non- FilePath-based contents, so we cannot apply the usual logic there. This partially reverts 218a8b77876027d5290a67af90c90590f23432da. Fixes: QTCREATORBUG-32147 Change-Id: Ic3176a78ec5915a9d420f742324407be1881338e Reviewed-by: hjk Reviewed-by: Andrii Semkiv --- src/plugins/clangtools/diagnosticconfigswidget.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/clangtools/diagnosticconfigswidget.cpp b/src/plugins/clangtools/diagnosticconfigswidget.cpp index a17334c4ce9..69369803645 100644 --- a/src/plugins/clangtools/diagnosticconfigswidget.cpp +++ b/src/plugins/clangtools/diagnosticconfigswidget.cpp @@ -401,7 +401,8 @@ static void buildTree(ProjectExplorer::Tree *parent, current->name = node.name; current->isDir = node.children.size(); if (parent) { - current->fullPath = parent->fullPath.pathAppended(current->name); + current->fullPath = Utils::FilePath::fromString(parent->fullPath.toString() + + current->name); parent->childDirectories.push_back(current); } else { current->fullPath = Utils::FilePath::fromString(current->name); @@ -412,9 +413,9 @@ static void buildTree(ProjectExplorer::Tree *parent, } static bool needsLink(ProjectExplorer::Tree *node) { - if (node->fullPath.path() == "clang-analyzer-") + if (node->fullPath.toString() == "clang-analyzer-") return true; - return !node->isDir && !node->fullPath.startsWith("clang-analyzer-"); + return !node->isDir && !node->fullPath.toString().startsWith("clang-analyzer-"); } class BaseChecksTreeModel : public ProjectExplorer::SelectableFilesModel // FIXME: This isn't about files. @@ -590,7 +591,7 @@ public: // 'clang-analyzer-' group if (node->isDir) return CppEditor::Constants::CLANG_STATIC_ANALYZER_DOCUMENTATION_URL; - return clangTidyDocUrl(node->fullPath.path()); + return clangTidyDocUrl(node->fullPath.toString()); } return BaseChecksTreeModel::data(fullIndex, role); @@ -628,7 +629,7 @@ private: return false; auto *node = static_cast(index.internalPointer()); - const QString nodeName = node->fullPath.path(); + const QString nodeName = node->fullPath.toString(); if ((check.endsWith("*") && nodeName.startsWith(check.left(check.length() - 1))) || (!node->isDir && nodeName == check)) { result = index; @@ -645,7 +646,7 @@ private: if (root->checked == Qt::Unchecked) return; if (root->checked == Qt::Checked) { - checks += "," + root->fullPath.path(); + checks += "," + root->fullPath.toString(); if (root->isDir) checks += "*"; return;