Commit 07147a32 authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Ask if the id exists instead of get the node and test it



Change-Id: I3604981fdeda7c3da67523d5d01b513b09037c7f
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent b8fb4a13
...@@ -112,13 +112,13 @@ static ModelNode resolveBinding(const QString &binding, ModelNode currentNode, A ...@@ -112,13 +112,13 @@ static ModelNode resolveBinding(const QString &binding, ModelNode currentNode, A
else else
return ModelNode(); //binding not valid return ModelNode(); //binding not valid
} else if (currentNode.hasProperty(element.toUtf8())) { } else if (currentNode.hasProperty(element.toUtf8())) {
if (currentNode.property(element.toUtf8()).isNodeProperty()) { if (currentNode.property(element.toUtf8()).isNodeProperty())
currentNode = currentNode.nodeProperty(element.toUtf8()).modelNode(); currentNode = currentNode.nodeProperty(element.toUtf8()).modelNode();
} else { else if (view->hasId(element))
currentNode = view->modelNodeForId(element); //id currentNode = view->modelNodeForId(element); //id
if (!currentNode.isValid()) else
return ModelNode(); //binding not valid return ModelNode(); //binding not valid
}
} else { } else {
currentNode = view->modelNodeForId(element); //id currentNode = view->modelNodeForId(element); //id
} }
...@@ -192,9 +192,8 @@ QList<ModelNode> BindingProperty::resolveToModelNodeList() const ...@@ -192,9 +192,8 @@ QList<ModelNode> BindingProperty::resolveToModelNodeList() const
string.remove(0, 1); string.remove(0, 1);
QStringList simplifiedList = commaSeparatedSimplifiedStringList(string); QStringList simplifiedList = commaSeparatedSimplifiedStringList(string);
foreach (const QString &nodeId, simplifiedList) { foreach (const QString &nodeId, simplifiedList) {
ModelNode modelNode = view()->modelNodeForId(nodeId); if (view()->hasId(nodeId))
if (modelNode.isValid()) returnList.append(view()->modelNodeForId(nodeId));
returnList.append(modelNode);
} }
} }
return returnList; return returnList;
......
Supports Markdown
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