QmlDesigner: catch RewritingException when moving nodes

found at https://the-qt-company-00.sentry.io/issues/6650630594

Pick-to: qds/4.7
Change-Id: Id968abcc08e601694ae612c6cb0c5fa80aa1c9ff
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Tim Jenßen
2025-06-04 14:27:59 +02:00
committed by Tim Jenssen
parent 4e5ea43f30
commit adaef5816f

View File

@@ -70,8 +70,13 @@ inline static void moveNodesUp(const QList<QmlDesigner::ModelNode> &nodes)
index--; index--;
if (index < 0) if (index < 0)
index = node.parentProperty().count() - 1; //wrap around index = node.parentProperty().count() - 1; //wrap around
if (oldIndex != index) if (oldIndex != index) {
node.parentProperty().toNodeListProperty().slide(oldIndex, index); try {
node.parentProperty().toNodeListProperty().slide(oldIndex, index);
} catch (QmlDesigner::Exception &exception) {
exception.showException();
}
}
} }
} }
} }
@@ -85,8 +90,13 @@ inline static void moveNodesDown(const QList<QmlDesigner::ModelNode> &nodes)
index++; index++;
if (index >= node.parentProperty().count()) if (index >= node.parentProperty().count())
index = 0; //wrap around index = 0; //wrap around
if (oldIndex != index) if (oldIndex != index) {
node.parentProperty().toNodeListProperty().slide(oldIndex, index); try {
node.parentProperty().toNodeListProperty().slide(oldIndex, index);
} catch (QmlDesigner::Exception &exception) {
exception.showException();
}
}
} }
} }
} }