From ae14ba3a509339eb7008fd3d918ff9034799bc4d Mon Sep 17 00:00:00 2001 From: Tomi Korpipaa Date: Thu, 12 Jan 2023 10:38:34 +0200 Subject: Fix qmlcustominput example for portrait mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pick-to: 6.2 6.4 6.5 Fixes: QTBUG-110040 Change-Id: I6446e6b7570f591e5af66fdd3cb587540023c9aa Reviewed-by: Sami Varanka Reviewed-by: Tomi Korpipää --- .../qmlcustominput/qml/qmlcustominput/main.qml | 84 +++++++++++----------- 1 file changed, 41 insertions(+), 43 deletions(-) (limited to 'examples') diff --git a/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml b/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml index e8db9281..2f7de8b3 100644 --- a/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml +++ b/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml @@ -12,6 +12,8 @@ Item { width: 1280 height: 720 + property bool portraitMode: width < height + Data { id: graphData } @@ -20,7 +22,7 @@ Item { id: dataView anchors.bottom: parent.bottom width: parent.width - height: parent.height - buttonLayout.height + height: parent.height - (portraitMode ? shadowToggle.height * 3 : shadowToggle.height) //! [0] Scatter3D { @@ -165,54 +167,50 @@ Item { } //! [7] - RowLayout { - id: buttonLayout - Layout.minimumHeight: shadowToggle.height - width: parent.width + + Button { + id: shadowToggle + width: portraitMode ? parent.width : parent.width / 3 anchors.left: parent.left - spacing: 0 - - Button { - id: shadowToggle - Layout.fillHeight: true - Layout.minimumWidth: parent.width / 3 // 3 buttons divided equally in the layout - text: scatterGraph.shadowsSupported ? "Hide Shadows" : "Shadows not supported" - enabled: scatterGraph.shadowsSupported - - onClicked: { - if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { - scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityMedium; - text = "Hide Shadows"; - } else { - scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone; - text = "Show Shadows"; - } + anchors.top: parent.top + text: scatterGraph.shadowsSupported ? "Hide Shadows" : "Shadows not supported" + enabled: scatterGraph.shadowsSupported + + onClicked: { + if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { + scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityMedium; + text = "Hide Shadows"; + } else { + scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone; + text = "Show Shadows"; } } + } - Button { - id: cameraToggle - Layout.fillHeight: true - Layout.minimumWidth: parent.width / 3 - text: "Pause Camera" - - onClicked: { - cameraAnimationX.paused = !cameraAnimationX.paused; - cameraAnimationY.paused = cameraAnimationX.paused; - if (cameraAnimationX.paused) { - text = "Animate Camera"; - } else { - text = "Pause Camera"; - } + Button { + id: cameraToggle + width: portraitMode ? parent.width : parent.width / 3 + anchors.left: portraitMode ? parent.left : shadowToggle.right + anchors.top: portraitMode ? shadowToggle.bottom : parent.top + text: "Pause Camera" + + onClicked: { + cameraAnimationX.paused = !cameraAnimationX.paused; + cameraAnimationY.paused = cameraAnimationX.paused; + if (cameraAnimationX.paused) { + text = "Animate Camera"; + } else { + text = "Pause Camera"; } } + } - Button { - id: exitButton - Layout.fillHeight: true - Layout.minimumWidth: parent.width / 3 - text: "Quit" - onClicked: Qt.quit(); - } + Button { + id: exitButton + width: portraitMode ? parent.width : parent.width / 3 + anchors.left: portraitMode ? parent.left : cameraToggle.right + anchors.top: portraitMode ? cameraToggle.bottom : parent.top + text: "Quit" + onClicked: Qt.quit(); } } -- cgit v1.2.3