summaryrefslogtreecommitdiffstats
path: root/examples/datavisualization/qmlcustominput
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:16:19 +0000
commit0c4960660f6459f4530b3ca088c2f787a70a1dbd (patch)
tree3687aeca7323dad45b097154e46e3827e1c6bfa5 /examples/datavisualization/qmlcustominput
parentd5c1920d77cd0a979fd618da7cde6c66d4afcd9d (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>
Diffstat (limited to 'examples/datavisualization/qmlcustominput')
-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 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();
}
}