forked from qt-creator/qt-creator
CMakePM: Do not show subfolders for custom source_groups
CMake does have a few default source groups (cmMakefile.cxx):
this->AddSourceGroup("", "^.*$");
this->AddSourceGroup("Source Files", CM_SOURCE_REGEX);
this->AddSourceGroup("Header Files", CM_HEADER_REGEX);
this->AddSourceGroup("Precompile Header File", CM_PCH_REGEX);
this->AddSourceGroup("CMake Rules", "\\.rule$");
this->AddSourceGroup("Resources", CM_RESOURCE_REGEX);
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
This commit will get Qt Creator to display the actual subfolder
structure only if the CMake setting "Show subfolders inside source group
folders" is set and for "Source Files" and "Header Files" source groups.
Any other source group or a custom source group defined by `source_group`
will not get this treatment, since this what the oder IDEs (e.g. Visual
Studio) and what the users expect to have.
Task-number: QTCREATORBUG-27432
Fixes: QTCREATORBUG-30620
Change-Id: I3c30814df2f76d18ee5fd4fd1356d4dfc4b9b09b
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -18,6 +18,11 @@ using namespace ProjectExplorer;
|
||||
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
bool sourcesOrHeadersFolder(const QString &displayName)
|
||||
{
|
||||
return displayName == "Source Files" || displayName == "Header Files";
|
||||
}
|
||||
|
||||
std::unique_ptr<FolderNode> createCMakeVFolder(const Utils::FilePath &basePath,
|
||||
int priority,
|
||||
const QString &displayName)
|
||||
@@ -25,8 +30,7 @@ std::unique_ptr<FolderNode> createCMakeVFolder(const Utils::FilePath &basePath,
|
||||
auto newFolder = std::make_unique<VirtualFolderNode>(basePath);
|
||||
newFolder->setPriority(priority);
|
||||
newFolder->setDisplayName(displayName);
|
||||
newFolder->setIsSourcesOrHeaders(displayName == "Source Files"
|
||||
|| displayName == "Header Files");
|
||||
newFolder->setIsSourcesOrHeaders(sourcesOrHeadersFolder(displayName));
|
||||
return newFolder;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user