Commit 2b0ffa34 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Thomas Hartmann

QmlDesigner: Remove export alias properties recursively

If a child node id have an export alias property this one was not deleted.
Now we delete the export alias properties of all child nodes.

Change-Id: Ica66a199e8a8d6615208e56dc46ee3de807ddcaa
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent 00f8b9ee
......@@ -273,6 +273,25 @@ static void removeStateOperationsForChildren(const QmlObjectNode &node)
}
}
static void removeAliasExports(const QmlObjectNode &node)
{
PropertyName propertyName = node.id().toLatin1();
ModelNode rootNode = node.view()->rootModelNode();
bool hasAliasExport = !propertyName.isEmpty()
&& rootNode.isValid()
&& rootNode.hasBindingProperty(propertyName)
&& rootNode.bindingProperty(propertyName).isAliasExport();
if (hasAliasExport)
rootNode.removeProperty(propertyName);
foreach (const ModelNode &childNode, node.modelNode().directSubModelNodes()) {
removeAliasExports(childNode);
}
}
/*!
Deletes this object's node and its dependencies from the model.
......@@ -284,6 +303,8 @@ void QmlObjectNode::destroy()
if (!isValid())
throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
removeAliasExports(modelNode());
foreach (QmlModelStateOperation stateOperation, allAffectingStatesOperations()) {
stateOperation.modelNode().destroy(); //remove of belonging StatesOperations
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment