Commit cedf7a01 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner: Adding try catch block

Change-Id: I4956b58f1ffd3bfdf0e6b810de1f411ae7d7f8a0
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 757153fc
......@@ -666,20 +666,24 @@ static bool isInLayoutable(NodeAbstractProperty &parentProperty)
static void reparentModelNodeToNodeProperty(NodeAbstractProperty &parentProperty, const ModelNode &modelNode)
{
if (!modelNode.hasParentProperty() || parentProperty != modelNode.parentProperty()) {
if (isInLayoutable(parentProperty)) {
removePosition(modelNode);
parentProperty.reparentHere(modelNode);
} else {
if (QmlItemNode::isValidQmlItemNode(modelNode)) {
QPointF scenePosition = QmlItemNode(modelNode).instanceScenePosition();
try {
if (!modelNode.hasParentProperty() || parentProperty != modelNode.parentProperty()) {
if (isInLayoutable(parentProperty)) {
removePosition(modelNode);
parentProperty.reparentHere(modelNode);
if (!scenePosition.isNull())
setScenePosition(modelNode, scenePosition);
} else {
parentProperty.reparentHere(modelNode);
if (QmlItemNode::isValidQmlItemNode(modelNode)) {
QPointF scenePosition = QmlItemNode(modelNode).instanceScenePosition();
parentProperty.reparentHere(modelNode);
if (!scenePosition.isNull())
setScenePosition(modelNode, scenePosition);
} else {
parentProperty.reparentHere(modelNode);
}
}
}
} catch (const RewritingException &exception) { //better safe than sorry! There always might be cases where we fail
exception.showException();
}
}
......
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