diff options
author | Dennis Oberst <dennis.oberst@qt.io> | 2023-04-12 13:44:25 +0200 |
---|---|---|
committer | Dennis Oberst <dennis.oberst@qt.io> | 2023-04-26 08:58:48 +0000 |
commit | aec41a55ab717eac1e29b50952c9bf37341692f4 (patch) | |
tree | 9daa9cbd771b32b040062c77cdaf1485b70c6d89 /examples/sensors/sensorsshowcase/accelerometer.qml | |
parent | 080823ec04f111ff82ae2fcfd5e2b98c4f6a722e (diff) | |
download | qtsensors-aec41a55ab717eac1e29b50952c9bf37341692f4.tar.gz |
Example: revamp sensorsshowcase
Updated the example to align with the Qt6 Example-Guideline.
https://wiki.qt.io/Qt6/Example-Guideline
Pick-to: 6.5
Task-number: QTBUG-111254
Change-Id: I8d8028ab5351cd801c8ce5126b1ebe5f2d0f4e50
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'examples/sensors/sensorsshowcase/accelerometer.qml')
-rw-r--r-- | examples/sensors/sensorsshowcase/accelerometer.qml | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/examples/sensors/sensorsshowcase/accelerometer.qml b/examples/sensors/sensorsshowcase/accelerometer.qml deleted file mode 100644 index e4f6e39..0000000 --- a/examples/sensors/sensorsshowcase/accelerometer.qml +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -import QtQuick -import QtQuick.Controls -import QtQuick.Layouts -import QtSensors - -Rectangle { - id: root - color: "dimgray" - - function resetRotations() { - imageXRotation.angle = 0 - imageYRotation.angle = 0 - imageZRotation.angle = 0 - } - -//! [0] - Accelerometer { - id: accelerometer - active: true - dataRate: 25 - - property real x: 0 - property real y: 0 - property real z: 0 - - onReadingChanged: { - x = reading.x - y = reading.y - z = reading.z - - imageTranslation.x = -reading.x * 10 - imageTranslation.y = reading.y * 10 - } - } -//! [0] - - ColumnLayout { - anchors.fill: parent - id: layout - - Text { - Layout.topMargin: titleTopMargin - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - Layout.preferredHeight: textHeight - color: "White" - text: "Accelerometer" - font.pixelSize: titleFontSize - } - - Image { - id: image - Layout.alignment: Qt.AlignCenter - Layout.fillHeight: true - Layout.preferredWidth: root.width/2 - Layout.preferredHeight: root.height/3 - source: "qrc:/images/qt_logo.png" - fillMode: Image.PreserveAspectFit - - transform: [ - Translate { - id: imageTranslation - x: 0 - y: 0 - } - ] - } - - Text { - Layout.preferredWidth: root.width - Layout.preferredHeight: textHeight - Layout.leftMargin: layout.spacing - color: "White" - text: "X: " + accelerometer.x.toFixed(2) - font.pixelSize: textFontSize - } - - ProgressBar { - id: xbar - value: 0.5 + (accelerometer.x / 100) - Layout.preferredWidth: root.width - } - - Text { - Layout.preferredWidth: root.width - Layout.preferredHeight: textHeight - Layout.leftMargin: layout.spacing - color: "White" - text: "Y: " + accelerometer.y.toFixed(2) - font.pixelSize: textFontSize - } - ProgressBar { - id: ybar - value: 0.5 + (accelerometer.y / 100) - Layout.preferredWidth: root.width - } - Text { - Layout.preferredWidth: root.width - Layout.preferredHeight: textHeight - Layout.leftMargin: layout.spacing - color: "White" - text: "Z: " + accelerometer.z.toFixed(2) - font.pixelSize: textFontSize - } - ProgressBar { - id: zbar - value: 0.5 + (accelerometer.z / 100) - Layout.preferredWidth: root.width - } - Button { - Layout.alignment: Qt.AlignBottom - Layout.preferredWidth: root.width - Layout.preferredHeight: buttonHeight - text:"Back" - font.pixelSize: buttonFontSize - onClicked:stack.pop() - } - } -} - |