summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2022-09-14 15:51:47 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2022-09-15 06:35:21 +0000
commit1fe4db0231b2d8438aeed9585654f100121fbf49 (patch)
tree8c11f536f42499d0c6120f6b22e4cacf62b02ae4
parent1d46fee51f581f27c8186ed432507bf5ab8253a8 (diff)
downloadqt-creator-1fe4db0231b2d8438aeed9585654f100121fbf49.tar.gz
QmlDesigner: Add removeKeyframesForTargetAndProperty
This allows to remove keyframe groups for a specific property. This is required if a dynamic property is removed. Change-Id: Ic3a2609241df21d81954ab18e4aeec1c47bfe336 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>
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmltimeline.h4
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmltimeline.cpp9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/designercore/include/qmltimeline.h b/src/plugins/qmldesigner/designercore/include/qmltimeline.h
index 1d9bb4b718..4c3a7bfa86 100644
--- a/src/plugins/qmldesigner/designercore/include/qmltimeline.h
+++ b/src/plugins/qmldesigner/designercore/include/qmltimeline.h
@@ -65,6 +65,10 @@ public:
QList<ModelNode> allTargets() const;
QList<QmlTimelineKeyframeGroup> keyframeGroupsForTarget(const ModelNode &target) const;
void destroyKeyframesForTarget(const ModelNode &target);
+
+ void removeKeyframesForTargetAndProperty(const ModelNode &target,
+ const PropertyName &propertyName);
+
static bool hasActiveTimeline(AbstractView *view);
bool isRecording() const;
diff --git a/src/plugins/qmldesigner/designercore/model/qmltimeline.cpp b/src/plugins/qmldesigner/designercore/model/qmltimeline.cpp
index d84f338741..ce981c2b93 100644
--- a/src/plugins/qmldesigner/designercore/model/qmltimeline.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmltimeline.cpp
@@ -208,6 +208,15 @@ void QmlTimeline::destroyKeyframesForTarget(const ModelNode &target)
frames.destroy();
}
+void QmlTimeline::removeKeyframesForTargetAndProperty(const ModelNode &target,
+ const PropertyName &propertyName)
+{
+ for (QmlTimelineKeyframeGroup frames : keyframeGroupsForTarget(target)) {
+ if (frames.propertyName() == propertyName)
+ frames.destroy();
+ }
+}
+
bool QmlTimeline::hasActiveTimeline(AbstractView *view)
{
if (view && view->isAttached()) {