forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
||||
@@ -388,6 +388,8 @@ public:
|
||||
// "build single file" case.
|
||||
virtual void build() {}
|
||||
|
||||
void setFallbackData(Core::Id key, const QVariant &value);
|
||||
|
||||
protected:
|
||||
void setIsProduct() { m_isProduct = true; }
|
||||
|
||||
@@ -395,6 +397,7 @@ protected:
|
||||
|
||||
private:
|
||||
bool m_isProduct = false;
|
||||
QHash<Core::Id, QVariant> m_fallbackData; // Used in data(), unless overridden.
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ContainerNode : public FolderNode
|
||||
|
||||
Reference in New Issue
Block a user