diff options
Diffstat (limited to 'examples/qmlcustominput/qml/qmlcustominput/main.qml')
-rw-r--r-- | examples/qmlcustominput/qml/qmlcustominput/main.qml | 77 |
1 files changed, 43 insertions, 34 deletions
diff --git a/examples/qmlcustominput/qml/qmlcustominput/main.qml b/examples/qmlcustominput/qml/qmlcustominput/main.qml index a7e7f466..6ba6c19e 100644 --- a/examples/qmlcustominput/qml/qmlcustominput/main.qml +++ b/examples/qmlcustominput/qml/qmlcustominput/main.qml @@ -17,6 +17,7 @@ ****************************************************************************/ import QtQuick 2.1 +import QtQuick.Layouts 1.0 import QtDataVisualization 1.0 import "." @@ -34,7 +35,7 @@ Item { id: dataView anchors.bottom: parent.bottom width: parent.width - height: parent.height - shadowToggle.height + height: parent.height - buttonLayout.height //! [0] Scatter3D { @@ -153,45 +154,53 @@ Item { } //! [7] - NewButton { - id: shadowToggle - width: parent.width / 3 // We're adding 3 buttons and want to divide them equally - text: "Hide Shadows" + RowLayout { + id: buttonLayout + Layout.minimumHeight: shadowToggle.height + width: parent.width anchors.left: parent.left - - onClicked: { - if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { - scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualitySoftMedium; - text = "Hide Shadows"; - } else { - scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone; - text = "Show Shadows"; + spacing: 0 + + NewButton { + id: shadowToggle + Layout.fillHeight: true + Layout.minimumWidth: parent.width / 3 // 3 buttons divided equally in the layout + text: "Hide Shadows" + + onClicked: { + if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { + scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualitySoftMedium; + text = "Hide Shadows"; + } else { + scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone; + text = "Show Shadows"; + } } } - } - NewButton { - id: cameraToggle - width: parent.width / 3 - text: "Animate Camera" - anchors.left: shadowToggle.right - - onClicked: { - cameraAnimationX.paused = !cameraAnimationX.paused; - cameraAnimationY.paused = cameraAnimationX.paused; - if (cameraAnimationX.paused) { - text = "Animate Camera"; - } else { - text = "Pause Camera"; + NewButton { + id: cameraToggle + Layout.fillHeight: true + Layout.minimumWidth: parent.width / 3 + text: "Animate Camera" + + onClicked: { + cameraAnimationX.paused = !cameraAnimationX.paused; + cameraAnimationY.paused = cameraAnimationX.paused; + if (cameraAnimationX.paused) { + text = "Animate Camera"; + } else { + text = "Pause Camera"; + } } } - } - NewButton { - id: exitButton - width: parent.width / 3 - text: "Quit" - anchors.left: cameraToggle.right - onClicked: Qt.quit(0); + NewButton { + id: exitButton + Layout.fillHeight: true + Layout.minimumWidth: parent.width / 3 + text: "Quit" + onClicked: Qt.quit(0); + } } } |