forked from qt-creator/qt-creator
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 218a8b7787
.
Fixes: QTCREATORBUG-32147
Change-Id: Ic3176a78ec5915a9d420f742324407be1881338e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Andrii Semkiv <andrii.semkiv@qt.io>
This commit is contained in:
@@ -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<Tree *>(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;
|
||||
|
Reference in New Issue
Block a user