ProjectExplorer: Add a mechanism to access fixed data in ProjectNodes

To be used in CMakeTargetNode for Android-specific items, but possibly
useful for other combinations, too, at the price of (only) one empty hash
per _Project_Node.

Change-Id: I4ced56a6ddfa54a00f96be0507a556fa7b20b552
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-08-01 11:53:26 +02:00
parent eefabf2b11
commit 0dc97a51b5
2 changed files with 9 additions and 2 deletions

View File

@@ -944,8 +944,7 @@ ProjectNode *ProjectNode::projectNode(const Utils::FilePath &file) const
QVariant ProjectNode::data(Core::Id role) const
{
Q_UNUSED(role)
return QVariant();
return m_fallbackData.value(role);
}
bool ProjectNode::setData(Core::Id role, const QVariant &value) const
@@ -955,6 +954,11 @@ bool ProjectNode::setData(Core::Id role, const QVariant &value) const
return false;
}
void ProjectNode::setFallbackData(Core::Id key, const QVariant &value)
{
m_fallbackData.insert(key, value);
}
bool FolderNode::isEmpty() const
{
return m_nodes.size() == 0;