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 <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2023-10-30 12:57:57 +02:00
parent 3a2927e200
commit 354da91222

View File

@@ -336,9 +336,7 @@ Item {
else if (resetToDefault) else if (resetToDefault)
splitView = false; splitView = false;
if (!splitView) if ("activeSplit" in toolStates)
activeSplit = 0;
else if ("activeSplit" in toolStates)
activeSplit = toolStates.activeSplit; activeSplit = toolStates.activeSplit;
else if (resetToDefault) else if (resetToDefault)
activeSplit = 0; activeSplit = 0;
@@ -532,9 +530,10 @@ Item {
function resolveSplitPoint(x, y) function resolveSplitPoint(x, y)
{ {
if (activeSplit === 0) if (!splitView || activeSplit === 0)
return Qt.point(x, y); return Qt.point(x, y);
else if (activeSplit === 1)
if (activeSplit === 1)
return Qt.point(x - viewContainer.width / 2, y); return Qt.point(x - viewContainer.width / 2, y);
else if (activeSplit === 2) else if (activeSplit === 2)
return Qt.point(x, y - viewContainer.height / 2); return Qt.point(x, y - viewContainer.height / 2);
@@ -556,8 +555,6 @@ Item {
else else
activeSplit = 3; activeSplit = 3;
} }
} else {
activeSplit = 0;
} }
} }
@@ -636,10 +633,11 @@ Item {
Rectangle { Rectangle {
id: viewRect0 id: viewRect0
width: splitView ? parent.width / 2 : parent.width width: viewRoot.splitView ? parent.width / 2 : parent.width
height: splitView ? parent.height / 2 : parent.height height: viewRoot.splitView ? parent.height / 2 : parent.height
x: 0 x: 0
y: 0 y: 0
visible: viewRoot.splitView || viewRoot.activeSplit == 0
gradient: bgGradient gradient: bgGradient
OverlayView3D { OverlayView3D {
id: overlayView0 id: overlayView0
@@ -647,7 +645,6 @@ Item {
viewRoot: viewRoot viewRoot: viewRoot
importScene: overlayScene importScene: overlayScene
onChangeObjectProperty: (nodes, props) => { onChangeObjectProperty: (nodes, props) => {
viewRoot.changeObjectProperty(nodes, props); viewRoot.changeObjectProperty(nodes, props);
} }
@@ -664,11 +661,11 @@ Item {
Rectangle { Rectangle {
id: viewRect1 id: viewRect1
width: parent.width / 2 width: viewRoot.splitView ? parent.width / 2 : parent.width
height: parent.height / 2 height: viewRoot.splitView ? parent.height / 2 : parent.height
x: parent.width / 2 x: viewRoot.splitView ? parent.width / 2 : 0
y: 0 y: 0
visible: splitView visible: viewRoot.splitView || viewRoot.activeSplit == 1
gradient: bgGradient gradient: bgGradient
OverlayView3D { OverlayView3D {
id: overlayView1 id: overlayView1
@@ -692,11 +689,11 @@ Item {
Rectangle { Rectangle {
id: viewRect2 id: viewRect2
width: parent.width / 2 width: viewRoot.splitView ? parent.width / 2 : parent.width
height: parent.height / 2 height: viewRoot.splitView ? parent.height / 2 : parent.height
x: 0 x: 0
y: parent.height / 2 y: viewRoot.splitView ? parent.height / 2 : 0
visible: splitView visible: viewRoot.splitView || viewRoot.activeSplit == 2
gradient: bgGradient gradient: bgGradient
OverlayView3D { OverlayView3D {
id: overlayView2 id: overlayView2
@@ -720,11 +717,11 @@ Item {
Rectangle { Rectangle {
id: viewRect3 id: viewRect3
width: parent.width / 2 width: viewRoot.splitView ? parent.width / 2 : parent.width
height: parent.height / 2 height: viewRoot.splitView ? parent.height / 2 : parent.height
x: parent.width / 2 x: viewRoot.splitView ? parent.width / 2 : 0
y: parent.height / 2 y: viewRoot.splitView ? parent.height / 2 : 0
visible: splitView visible: viewRoot.splitView || viewRoot.activeSplit == 3
gradient: bgGradient gradient: bgGradient
OverlayView3D { OverlayView3D {
id: overlayView3 id: overlayView3
@@ -748,7 +745,7 @@ Item {
Rectangle { Rectangle {
// Vertical border between splits // Vertical border between splits
visible: splitView visible: viewRoot.splitView
x: parent.width / 2 x: parent.width / 2
y: 0 y: 0
width: 1 width: 1
@@ -759,7 +756,7 @@ Item {
Rectangle { Rectangle {
// Horizontal border between splits // Horizontal border between splits
visible: splitView visible: viewRoot.splitView
x: 0 x: 0
y: parent.height / 2 y: parent.height / 2
height: 1 height: 1
@@ -770,11 +767,13 @@ Item {
Rectangle { Rectangle {
// Active split highlight // Active split highlight
visible: splitView visible: viewRoot.splitView
x: viewRects[activeSplit].x x: viewRects[viewRoot.activeSplit].x
y: viewRects[activeSplit].y y: viewRects[viewRoot.activeSplit].y
height: viewRects[activeSplit].height + (activeSplit === 0 || activeSplit === 1 ? 1 : 0) height: viewRects[viewRoot.activeSplit].height
width: viewRects[activeSplit].width + (activeSplit === 0 || activeSplit === 2 ? 1 : 0) + (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.width: 1
border.color: "#57B9FC" border.color: "#57B9FC"
color: "transparent" color: "transparent"