forked from qt-creator/qt-creator
CMakePM: Remove <Headers> virtual project node
CMake projects need to add the headers as source files in order to get exported from the CMake file-api json export. Having header files that are not part of the project displayed in the <Headers> node is error prone and confusing. This also means that you won't get bogus files when doing git commit for example. Fixes: QTCREATORBUG-18206 Fixes: QTCREATORBUG-24609 Fixes: QTCREATORBUG-25407 Change-Id: I89ac4f8a80f452119f8a991b9e4ef14efb7a86b9 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -175,39 +175,6 @@ CMakeTargetNode *createTargetNode(const QHash<Utils::FilePath, ProjectNode *> &c
|
||||
return tn;
|
||||
}
|
||||
|
||||
void addHeaderNodes(ProjectNode *root,
|
||||
QSet<Utils::FilePath> &seenHeaders,
|
||||
const QList<FileNode *> &allFiles)
|
||||
{
|
||||
QTC_ASSERT(root, return );
|
||||
|
||||
if (root->isEmpty())
|
||||
return;
|
||||
|
||||
auto headerNode = std::make_unique<VirtualFolderNode>(root->filePath());
|
||||
headerNode->setPriority(Node::DefaultPriority - 5);
|
||||
headerNode->setDisplayName(
|
||||
QCoreApplication::translate("CMakeProjectManager::Internal::ProjectTreeHelper",
|
||||
"<Headers>"));
|
||||
headerNode->setIcon(DirectoryIcon(ProjectExplorer::Constants::FILEOVERLAY_H));
|
||||
|
||||
// Add scanned headers:
|
||||
for (const FileNode *fn : allFiles) {
|
||||
if (fn->fileType() != FileType::Header || !fn->filePath().isChildOf(root->filePath()))
|
||||
continue;
|
||||
const int count = seenHeaders.count();
|
||||
seenHeaders.insert(fn->filePath());
|
||||
if (seenHeaders.count() != count) {
|
||||
std::unique_ptr<FileNode> node(fn->clone());
|
||||
node->setEnabled(false);
|
||||
headerNode->addNestedNode(std::move(node));
|
||||
}
|
||||
}
|
||||
|
||||
if (!headerNode->isEmpty())
|
||||
root->addNode(std::move(headerNode));
|
||||
}
|
||||
|
||||
template<typename Result>
|
||||
static std::unique_ptr<Result> cloneFolderNode(FolderNode *node)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user