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: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2015-07-08 11:51:14 +02:00
committed by Thomas Hartmann
parent 00f8b9ee23
commit 2b0ffa3448

View File

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