diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2021-01-12 15:32:53 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2021-01-19 13:07:06 +0200 |
commit | 5782dd031e5fe8925f2d4715ceef562a1d8a36d1 (patch) | |
tree | 6e13147842da66f49ae9c1579d2d600bf16d228d /examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml | |
parent | 8e3174f29d7e4df8457b52009ee5f64a5eb9b5a1 (diff) |
Fix qmloscilloscope example for Qt 6
OpenGL acceleration of series only works when OpenGL backend is used,
so added detection for that and also provided instruction how to
force it on.
Removed Quick Controls v1 usage as it's no longer supported in Qt 6.
Change-Id: I169f4b1cfeb33dded4b6a51c34cd35daf189954f
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml')
-rw-r--r-- | examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml b/examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml index 8eb6eb67..79322a29 100644 --- a/examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml +++ b/examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml @@ -27,9 +27,7 @@ ** ****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 +import QtQuick Item { id: button @@ -44,26 +42,39 @@ Item { implicitWidth: buttonText.implicitWidth + 5 implicitHeight: buttonText.implicitHeight + 10 - Button { - id: buttonText - width: parent.width - height: parent.height + Rectangle { + anchors.fill: parent + radius: 3 + gradient: button.enabled ? enabledGradient : disabledGradient - style: ButtonStyle { - label: Component { - Text { - text: button.text + button.items[currentSelection] - clip: true - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - anchors.fill: parent - } - } + Gradient { + id: enabledGradient + GradientStop { position: 0.0; color: "#eeeeee" } + GradientStop { position: 1.0; color: "#cccccc" } + } + Gradient { + id: disabledGradient + GradientStop { position: 0.0; color: "#444444" } + GradientStop { position: 1.0; color: "#666666" } + } + + Text { + id: buttonText + text: button.text + button.items[currentSelection] + clip: true + wrapMode: Text.WordWrap + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + anchors.fill: parent + font.pointSize: 14 } - onClicked: { - currentSelection = (currentSelection + 1) % items.length; - selectionChanged(button.items[currentSelection]); + + MouseArea { + anchors.fill: parent + onClicked: { + currentSelection = (currentSelection + 1) % items.length; + selectionChanged(button.items[currentSelection]); + } } } } |