summaryrefslogtreecommitdiffstats
path: root/examples/datavisualization/qmlcustominput/qml/qmlcustominput
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2023-01-12 10:38:34 +0200
committerTomi Korpipaa <tomi.korpipaa@qt.io>2023-01-12 15:03:34 +0200
commitae14ba3a509339eb7008fd3d918ff9034799bc4d (patch)
treeb8f8fc432ba6cf1942a31fb9f69011425fbcd011 /examples/datavisualization/qmlcustominput/qml/qmlcustominput
parenta3c9f188b4afd9e0a5dfb621b1d995688206400f (diff)
Fix qmlcustominput example for portrait mode
Pick-to: 6.2 6.4 6.5 Fixes: QTBUG-110040 Change-Id: I6446e6b7570f591e5af66fdd3cb587540023c9aa Reviewed-by: Sami Varanka <sami.varanka@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'examples/datavisualization/qmlcustominput/qml/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();
}
}