aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2019-08-19 15:47:30 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2019-08-23 08:05:51 +0000
commit7393305b31b657bcd0f11ae4a584373f8fd8ec87 (patch)
tree9f0abce70c78e81faadec54f9468912f6066ab56 /src
parent33a4f8ab3c496b4cb356a7babd48b8018de391c8 (diff)
QmlDesigner: Do not use z-order for toFront/toBack
Task-number: QDS-370 Change-Id: I1cfff1b0f87e6dacb1f08c01a7b04d06eadb78e1 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
index 9f880c453b..d1fec2cd4a 100644
--- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
@@ -198,9 +198,13 @@ void toFront(const SelectionContext &selectionState)
try {
QmlItemNode node = selectionState.firstSelectedModelNode();
if (node.isValid()) {
- signed int maximumZ = getMaxZValue(siblingsForNode(node));
- maximumZ++;
- node.setVariantProperty("z", maximumZ);
+ ModelNode modelNode = selectionState.currentSingleSelectedNode();
+ NodeListProperty parentProperty = modelNode.parentProperty().toNodeListProperty();
+ const int index = parentProperty.indexOf(modelNode);
+ const int lastIndex = parentProperty.count() - 1;
+
+ if (index != lastIndex)
+ parentProperty.slide(index, lastIndex);
}
} catch (const RewritingException &e) { //better save then sorry
e.showException();
@@ -215,9 +219,12 @@ void toBack(const SelectionContext &selectionState)
try {
QmlItemNode node = selectionState.firstSelectedModelNode();
if (node.isValid()) {
- signed int minimumZ = getMinZValue(siblingsForNode(node));
- minimumZ--;
- node.setVariantProperty("z", minimumZ);
+ ModelNode modelNode = selectionState.currentSingleSelectedNode();
+ NodeListProperty parentProperty = modelNode.parentProperty().toNodeListProperty();
+ const int index = parentProperty.indexOf(modelNode);
+
+ if (index != 0)
+ parentProperty.slide(index, 0);
}
} catch (const RewritingException &e) { //better save then sorry