forked from qt-creator/qt-creator
QmlDesigner: catch RewritingException when moving nodes
found at https://the-qt-company-00.sentry.io/issues/6650630594
Change-Id: Id968abcc08e601694ae612c6cb0c5fa80aa1c9ff
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
(cherry picked from commit adaef5816f
)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
@@ -67,8 +67,13 @@ inline static void moveNodesUp(const QList<QmlDesigner::ModelNode> &nodes)
|
||||
index--;
|
||||
if (index < 0)
|
||||
index = node.parentProperty().count() - 1; //wrap around
|
||||
if (oldIndex != index)
|
||||
node.parentProperty().toNodeListProperty().slide(oldIndex, index);
|
||||
if (oldIndex != index) {
|
||||
try {
|
||||
node.parentProperty().toNodeListProperty().slide(oldIndex, index);
|
||||
} catch (QmlDesigner::Exception &exception) {
|
||||
exception.showException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,8 +87,13 @@ inline static void moveNodesDown(const QList<QmlDesigner::ModelNode> &nodes)
|
||||
index++;
|
||||
if (index >= node.parentProperty().count())
|
||||
index = 0; //wrap around
|
||||
if (oldIndex != index)
|
||||
node.parentProperty().toNodeListProperty().slide(oldIndex, index);
|
||||
if (oldIndex != index) {
|
||||
try {
|
||||
node.parentProperty().toNodeListProperty().slide(oldIndex, index);
|
||||
} catch (QmlDesigner::Exception &exception) {
|
||||
exception.showException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user