From 354da9122236355b80da7d4ceb7d4bc9b36617b1 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 30 Oct 2023 12:57:57 +0200 Subject: [PATCH] QmlDesigner: Show currently active split when toggling off split view The active split is preserved even when split view is not enabled, so the content of the split that was active when split was toggled off is shown in full view. Fixes: QDS-11041 Change-Id: I764f6afb10271947443aa31e92df1778ddac4e03 Reviewed-by: Mahmoud Badri --- .../qml2puppet/mockfiles/qt6/EditView3D.qml | 59 +++++++++---------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/src/tools/qml2puppet/mockfiles/qt6/EditView3D.qml b/src/tools/qml2puppet/mockfiles/qt6/EditView3D.qml index 347e0b99479..6d9a89b89f2 100644 --- a/src/tools/qml2puppet/mockfiles/qt6/EditView3D.qml +++ b/src/tools/qml2puppet/mockfiles/qt6/EditView3D.qml @@ -336,9 +336,7 @@ Item { else if (resetToDefault) splitView = false; - if (!splitView) - activeSplit = 0; - else if ("activeSplit" in toolStates) + if ("activeSplit" in toolStates) activeSplit = toolStates.activeSplit; else if (resetToDefault) activeSplit = 0; @@ -532,9 +530,10 @@ Item { function resolveSplitPoint(x, y) { - if (activeSplit === 0) + if (!splitView || activeSplit === 0) return Qt.point(x, y); - else if (activeSplit === 1) + + if (activeSplit === 1) return Qt.point(x - viewContainer.width / 2, y); else if (activeSplit === 2) return Qt.point(x, y - viewContainer.height / 2); @@ -556,8 +555,6 @@ Item { else activeSplit = 3; } - } else { - activeSplit = 0; } } @@ -636,10 +633,11 @@ Item { Rectangle { id: viewRect0 - width: splitView ? parent.width / 2 : parent.width - height: splitView ? parent.height / 2 : parent.height + width: viewRoot.splitView ? parent.width / 2 : parent.width + height: viewRoot.splitView ? parent.height / 2 : parent.height x: 0 y: 0 + visible: viewRoot.splitView || viewRoot.activeSplit == 0 gradient: bgGradient OverlayView3D { id: overlayView0 @@ -647,7 +645,6 @@ Item { viewRoot: viewRoot importScene: overlayScene - onChangeObjectProperty: (nodes, props) => { viewRoot.changeObjectProperty(nodes, props); } @@ -664,11 +661,11 @@ Item { Rectangle { id: viewRect1 - width: parent.width / 2 - height: parent.height / 2 - x: parent.width / 2 + width: viewRoot.splitView ? parent.width / 2 : parent.width + height: viewRoot.splitView ? parent.height / 2 : parent.height + x: viewRoot.splitView ? parent.width / 2 : 0 y: 0 - visible: splitView + visible: viewRoot.splitView || viewRoot.activeSplit == 1 gradient: bgGradient OverlayView3D { id: overlayView1 @@ -692,11 +689,11 @@ Item { Rectangle { id: viewRect2 - width: parent.width / 2 - height: parent.height / 2 + width: viewRoot.splitView ? parent.width / 2 : parent.width + height: viewRoot.splitView ? parent.height / 2 : parent.height x: 0 - y: parent.height / 2 - visible: splitView + y: viewRoot.splitView ? parent.height / 2 : 0 + visible: viewRoot.splitView || viewRoot.activeSplit == 2 gradient: bgGradient OverlayView3D { id: overlayView2 @@ -720,11 +717,11 @@ Item { Rectangle { id: viewRect3 - width: parent.width / 2 - height: parent.height / 2 - x: parent.width / 2 - y: parent.height / 2 - visible: splitView + width: viewRoot.splitView ? parent.width / 2 : parent.width + height: viewRoot.splitView ? parent.height / 2 : parent.height + x: viewRoot.splitView ? parent.width / 2 : 0 + y: viewRoot.splitView ? parent.height / 2 : 0 + visible: viewRoot.splitView || viewRoot.activeSplit == 3 gradient: bgGradient OverlayView3D { id: overlayView3 @@ -748,7 +745,7 @@ Item { Rectangle { // Vertical border between splits - visible: splitView + visible: viewRoot.splitView x: parent.width / 2 y: 0 width: 1 @@ -759,7 +756,7 @@ Item { Rectangle { // Horizontal border between splits - visible: splitView + visible: viewRoot.splitView x: 0 y: parent.height / 2 height: 1 @@ -770,11 +767,13 @@ Item { Rectangle { // Active split highlight - visible: splitView - x: viewRects[activeSplit].x - y: viewRects[activeSplit].y - height: viewRects[activeSplit].height + (activeSplit === 0 || activeSplit === 1 ? 1 : 0) - width: viewRects[activeSplit].width + (activeSplit === 0 || activeSplit === 2 ? 1 : 0) + visible: viewRoot.splitView + x: viewRects[viewRoot.activeSplit].x + y: viewRects[viewRoot.activeSplit].y + height: viewRects[viewRoot.activeSplit].height + + (viewRoot.activeSplit === 0 || viewRoot.activeSplit === 1 ? 1 : 0) + width: viewRects[viewRoot.activeSplit].width + + (viewRoot.activeSplit === 0 || viewRoot.activeSplit === 2 ? 1 : 0) border.width: 1 border.color: "#57B9FC" color: "transparent"