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>
This commit is contained in:
Thomas Hartmann
2022-09-14 15:51:47 +02:00
parent 1d46fee51f
commit 1fe4db0231
2 changed files with 13 additions and 0 deletions

View File

@@ -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;

View File

@@ -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()) {