QmlDesigner: Add allTimelines

This makes it easy to retrieve all existing timelines.

Change-Id: I61fdacce28ea7c8afe48da81b87c8b47ee1cec26
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Thomas Hartmann
2022-09-14 15:52:43 +02:00
parent ed46f1f002
commit 1d46fee51f
2 changed files with 14 additions and 0 deletions

View File

@@ -138,6 +138,8 @@ public:
QmlModelStateGroup states() const;
QList<ModelNode> allTimelines() const;
protected:
NodeInstance nodeInstance() const;
QmlObjectNode nodeForInstance(const NodeInstance &instance) const;

View File

@@ -590,6 +590,18 @@ QmlModelStateGroup QmlObjectNode::states() const
return QmlModelStateGroup();
}
QList<ModelNode> QmlObjectNode::allTimelines() const
{
QList<ModelNode> timelineNodes;
const auto allNodes = view()->allModelNodes();
for (const auto &timelineNode : allNodes) {
if (QmlTimeline::isValidQmlTimeline(timelineNode))
timelineNodes.append(timelineNode);
}
return timelineNodes;
}
/*!
Removes a variant property of the object specified by \a name from the
model.