diff options
Diffstat (limited to 'examples/qmlscatter/qml/qmlscatter/main.qml')
-rw-r--r-- | examples/qmlscatter/qml/qmlscatter/main.qml | 157 |
1 files changed, 85 insertions, 72 deletions
diff --git a/examples/qmlscatter/qml/qmlscatter/main.qml b/examples/qmlscatter/qml/qmlscatter/main.qml index 40e48996..338bec24 100644 --- a/examples/qmlscatter/qml/qmlscatter/main.qml +++ b/examples/qmlscatter/qml/qmlscatter/main.qml @@ -18,6 +18,7 @@ //! [0] import QtQuick 2.1 +import QtQuick.Layouts 1.0 import QtDataVisualization 1.0 import "." //! [0] @@ -49,7 +50,7 @@ Item { anchors.bottom: parent.bottom //! [9] width: parent.width - height: parent.height - shadowToggle.height + height: parent.height - buttonLayout.height //! [8] //! [2] @@ -126,90 +127,102 @@ Item { } } - //! [7] - NewButton { - id: shadowToggle - width: parent.width / 6 // We're adding 6 buttons and want to divide them equally - text: "Hide Shadows" - onClicked: { - if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { - scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualitySoftLow; - text = "Hide Shadows"; - } else { - scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone; - text = "Show Shadows"; + RowLayout { + id: buttonLayout + Layout.minimumHeight: cameraToggle.height + width: parent.width + anchors.left: parent.left + spacing: 0 + //! [7] + NewButton { + id: shadowToggle + Layout.fillHeight: true + Layout.fillWidth: true + text: "Hide Shadows" + onClicked: { + if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { + scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualitySoftLow; + text = "Hide Shadows"; + } else { + scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone; + text = "Show Shadows"; + } } } - } - //! [7] - - NewButton { - id: smoothToggle - width: parent.width / 6 - text: "Use Smooth for Series One" - anchors.left: shadowToggle.right - onClicked: { - if (scatterSeries.meshSmooth === false) { - text = "Use Flat for Series One"; - scatterSeries.meshSmooth = true; - } else { - text = "Use Smooth for Series One" - scatterSeries.meshSmooth = false; + //! [7] + + NewButton { + id: smoothToggle + Layout.fillHeight: true + Layout.fillWidth: true + text: "Use Smooth Dots" + onClicked: { + if (scatterSeries.meshSmooth === false) { + text = "Use Flat for Series One"; + scatterSeries.meshSmooth = true; + } else { + text = "Use Smooth for Series One" + scatterSeries.meshSmooth = false; + } } } - } - NewButton { - id: cameraToggle - width: parent.width / 6 - text: "Change Camera Placement" - anchors.left: smoothToggle.right - onClicked: { - if (scatterGraph.scene.activeCamera.cameraPreset === Camera3D.CameraPresetFront) { - scatterGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetIsometricRightHigh; - } else { - scatterGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetFront; + NewButton { + id: cameraToggle + Layout.fillHeight: true + Layout.fillWidth: true + text: "Change Camera Placement" + onClicked: { + if (scatterGraph.scene.activeCamera.cameraPreset === Camera3D.CameraPresetFront) { + scatterGraph.scene.activeCamera.cameraPreset = + Camera3D.CameraPresetIsometricRightHigh; + } else { + scatterGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetFront; + } } } - } - NewButton { - id: themeToggle - width: parent.width / 6 - text: "Change Theme" - anchors.left: cameraToggle.right - onClicked: { - if (scatterGraph.theme.type === Theme3D.ThemeArmyBlue) { - // Ownership of the theme is transferred and old theme is destroyed when setting - // a new one, so we need to create them dynamically - scatterGraph.theme = Qt.createQmlObject('import QtDataVisualization 1.0; Theme3D {type: Theme3D.ThemeIsabelle; font.family: "Lucida Handwriting"; font.pointSize: 40}', parent); - } else { - scatterGraph.theme = Qt.createQmlObject('import QtDataVisualization 1.0; Theme3D {type: Theme3D.ThemeArmyBlue}', parent); + NewButton { + id: themeToggle + Layout.fillHeight: true + Layout.fillWidth: true + text: "Change Theme" + onClicked: { + if (scatterGraph.theme.type === Theme3D.ThemeArmyBlue) { + // Ownership of the theme is transferred and old theme is destroyed when setting + // a new one, so we need to create them dynamically + scatterGraph.theme = Qt.createQmlObject('import QtDataVisualization 1.0; + Theme3D {type: Theme3D.ThemeIsabelle; font.family: "Lucida Handwriting"; + font.pointSize: 40}', parent); + } else { + scatterGraph.theme = Qt.createQmlObject('import QtDataVisualization 1.0; + Theme3D {type: Theme3D.ThemeArmyBlue}', parent); + } } } - } - NewButton { - id: backgroundToggle - width: parent.width / 6 - text: "Hide Background" - anchors.left: themeToggle.right - onClicked: { - if (scatterGraph.theme.backgroundEnabled === true) { - scatterGraph.theme.backgroundEnabled = false; - text = "Show Background"; - } else { - scatterGraph.theme.backgroundEnabled = true; - text = "Hide Background"; + NewButton { + id: backgroundToggle + Layout.fillHeight: true + Layout.fillWidth: true + text: "Hide Background" + onClicked: { + if (scatterGraph.theme.backgroundEnabled === true) { + scatterGraph.theme.backgroundEnabled = false; + text = "Show Background"; + } else { + scatterGraph.theme.backgroundEnabled = true; + text = "Hide Background"; + } } } - } - NewButton { - id: exitButton - width: parent.width / 6 - text: "Quit" - anchors.left: backgroundToggle.right - onClicked: Qt.quit(0); + NewButton { + id: exitButton + Layout.fillHeight: true + Layout.fillWidth: true + text: "Quit" + onClicked: Qt.quit(0); + } } } |