summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2023-01-12 10:38:34 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-12 14:29:21 +0000
commit257eb22cf82289d7e46a645066e6562cf5b5c809 (patch)
tree90ea9dc93e7aac394a942b4eab72d7e957e68526
parent2f104f678602a77fa85fd343336bf7a891834da0 (diff)
Fix qmlcustominput example for portrait mode
Fixes: QTBUG-110040 Change-Id: I6446e6b7570f591e5af66fdd3cb587540023c9aa Reviewed-by: Sami Varanka <sami.varanka@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> (cherry picked from commit ae14ba3a509339eb7008fd3d918ff9034799bc4d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml84
1 files changed, 41 insertions, 43 deletions
diff --git a/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml b/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml
index 77576127..8bd906fd 100644
--- a/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml
+++ b/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml
@@ -38,6 +38,8 @@ Item {
width: 1280
height: 720
+ property bool portraitMode: width < height
+
Data {
id: graphData
}
@@ -46,7 +48,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 {
@@ -191,54 +193,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();
}
}