From c0dfb3ce57482e5630e28364692d2ba89a871a51 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 18 Apr 2024 14:29:48 +0200 Subject: [PATCH] CMakePM: Hide QML clutter project files Hide some of the QML files that we not marked as generated by the Qt QML CMake code Fixes: QTCREATORBUG-29631 Change-Id: I01fb571c0c3ff7d8a3861ddaaf7c6d6817c8cc51 Reviewed-by: Thomas Hartmann --- .../cmakeprojectmanager/fileapidataextractor.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index c2a3e5804ab..cfe17d19d46 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -684,6 +684,22 @@ static void addCompileGroups(ProjectNode *targetRoot, if (isPchFile(buildDirectory, sourcePath) || isUnityFile(buildDirectory, sourcePath)) node->setIsGenerated(true); + // Hide some of the QML files that we not marked as generated by the Qt QML CMake code + const bool buildDirQmldirOrRcc = sourcePath.isChildOf(buildDirectory) + && (sourcePath.parentDir().fileName() == ".rcc" + || sourcePath.fileName() == "qmldir"); + const bool otherDirQmldirOrMetatypes = !sourcePath.isChildOf(buildDirectory) + && !sourcePath.isChildOf(sourceDirectory) + && (sourcePath.parentDir().fileName() == "metatypes" + || sourcePath.fileName() == "qmldir"); + const bool buildDirPluginCpp = sourcePath.isChildOf(buildDirectory) + && td.type.endsWith("_LIBRARY") + && sourcePath.fileName().startsWith(td.name) + && sourcePath.fileName().endsWith("Plugin.cpp"); + + if (buildDirQmldirOrRcc || otherDirQmldirOrMetatypes || buildDirPluginCpp) + node->setIsGenerated(true); + const bool showSourceFolders = settings().showSourceSubFolders() && sourcesOrHeadersFolder(td.sourceGroups[si.sourceGroup]);