diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp index 62411e72c56..0ebcca588bf 100644 --- a/src/plugins/projectexplorer/projectnodes.cpp +++ b/src/plugins/projectexplorer/projectnodes.cpp @@ -762,7 +762,7 @@ bool FolderNode::showInSimpleTree() const bool FolderNode::showWhenEmpty() const { - return false; + return m_showWhenEmpty; } /*! @@ -904,6 +904,11 @@ void FolderNode::handleSubTreeChanged(FolderNode *node) parent->handleSubTreeChanged(node); } +void FolderNode::setShowWhenEmpty(bool showWhenEmpty) +{ + m_showWhenEmpty = showWhenEmpty; +} + ContainerNode::ContainerNode(Project *project) : FolderNode(project->projectDirectory()), m_project(project) { diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h index 0d1e703e0b9..7d7d022299d 100644 --- a/src/plugins/projectexplorer/projectnodes.h +++ b/src/plugins/projectexplorer/projectnodes.h @@ -281,8 +281,10 @@ public: // determines if node will be shown in the flat view, by default folder and projects aren't shown virtual bool showInSimpleTree() const; + // determines if node will always be shown when hiding empty directories - virtual bool showWhenEmpty() const; + bool showWhenEmpty() const; + void setShowWhenEmpty(bool showWhenEmpty); void addNode(std::unique_ptr &&node); std::unique_ptr takeNode(Node *node); @@ -302,6 +304,7 @@ private: QString m_displayName; QString m_addFileFilter; mutable QIcon m_icon; + bool m_showWhenEmpty = false; }; class PROJECTEXPLORER_EXPORT VirtualFolderNode : public FolderNode diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp index cc9888ca6ac..ae9d8c7d619 100644 --- a/src/plugins/resourceeditor/resourcenode.cpp +++ b/src/plugins/resourceeditor/resourcenode.cpp @@ -489,11 +489,6 @@ bool ResourceTopLevelNode::showInSimpleTree() const return true; } -bool ResourceTopLevelNode::showWhenEmpty() const -{ - return true; -} - ResourceFolderNode::ResourceFolderNode(const QString &prefix, const QString &lang, ResourceTopLevelNode *parent) : FolderNode(FileName(parent->filePath()).appendPath(prefix)), // TOOD Why add existing directory doesn't work @@ -501,7 +496,7 @@ ResourceFolderNode::ResourceFolderNode(const QString &prefix, const QString &lan m_prefix(prefix), m_lang(lang) { - + setShowWhenEmpty(true); } ResourceFolderNode::~ResourceFolderNode() = default; diff --git a/src/plugins/resourceeditor/resourcenode.h b/src/plugins/resourceeditor/resourcenode.h index f732c6ae522..089f9170f76 100644 --- a/src/plugins/resourceeditor/resourcenode.h +++ b/src/plugins/resourceeditor/resourcenode.h @@ -50,7 +50,6 @@ public: AddNewInformation addNewInformation(const QStringList &files, Node *context) const override; bool showInSimpleTree() const override; - bool showWhenEmpty() const override; bool removeNonExistingFiles(); QString contents() const { return m_contents; }