Commit 5ed046f1 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.Navigator: more checks for the reparenting button

We check for defaultPropertyIsComponent() and the metaInfo has to be valid.

Change-Id: I957c8440facec0ba54e527f2eda40926c5637b31
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 2b8ab0af
......@@ -336,13 +336,16 @@ void NavigatorView::rightButtonClicked()
if (index >= 0) { //for the first node the semantics are not clear enough. Wrapping would be irritating.
ModelNode newParent = node.parentProperty().toNodeListProperty().at(index);
if (QmlItemNode::isValidQmlItemNode(node)) {
if (QmlItemNode::isValidQmlItemNode(node)
&& QmlItemNode::isValidQmlItemNode(newParent)
&& !newParent.metaInfo().defaultPropertyIsComponent()) {
QPointF scenePos = QmlItemNode(node).instanceScenePosition();
newParent.nodeAbstractProperty(newParent.metaInfo().defaultPropertyName()).reparentHere(node);
if (!scenePos.isNull())
setScenePos(node, scenePos);
} else {
newParent.nodeAbstractProperty(newParent.metaInfo().defaultPropertyName()).reparentHere(node);
if (newParent.metaInfo().isValid() && !newParent.metaInfo().defaultPropertyIsComponent())
newParent.nodeAbstractProperty(newParent.metaInfo().defaultPropertyName()).reparentHere(node);
}
}
}
......
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