QmlDesigner: Properly destroy all keyframe groups for deleted nodes

QmlObjectNode::destroy() is not called for implicitly destroyed
subnodes when a node is deleted, so we need to account for those when
removing keyframe groups from timelines.

Change-Id: I21c838d84b5da17d772202961b3b1267e09c7050
Fixes: QDS-1880
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-04-03 15:41:28 +03:00
committed by Thomas Hartmann
parent fee8848297
commit 4569559898

View File

@@ -367,11 +367,18 @@ void QmlObjectNode::destroy()
stateOperation.modelNode().destroy(); //remove of belonging StatesOperations
}
for (const ModelNode &timelineNode : view()->allModelNodes()) {
if (QmlTimeline::isValidQmlTimeline(timelineNode)) {
QmlTimeline timeline(timelineNode);
timeline.destroyKeyframesForTarget(modelNode());
}
QVector<ModelNode> timelineNodes;
const auto allNodes = view()->allModelNodes();
for (const auto &timelineNode : allNodes) {
if (QmlTimeline::isValidQmlTimeline(timelineNode))
timelineNodes.append(timelineNode);
}
const auto subNodes = modelNode().allSubModelNodesAndThisNode();
for (auto &timelineNode : qAsConst(timelineNodes)) {
QmlTimeline timeline(timelineNode);
for (const auto &subNode : subNodes)
timeline.destroyKeyframesForTarget(subNode);
}
if (QmlFlowActionAreaNode::isValidQmlFlowActionAreaNode(modelNode()))