summaryrefslogtreecommitdiff
path: root/examples/bluetooth/heartrate-game/StatsLabel.qml
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2023-03-24 15:10:22 +0100
committerIvan Solovev <ivan.solovev@qt.io>2023-03-28 14:44:21 +0200
commit007bf2bcf10007b02dd5fe09c0fc4be24229af14 (patch)
tree628e057af54c8b07db611fec7ca696c6ba5389dc /examples/bluetooth/heartrate-game/StatsLabel.qml
parenta1f43b9dcd722527d52ceb0c7a138bd2994c1a7b (diff)
downloadqtconnectivity-007bf2bcf10007b02dd5fe09c0fc4be24229af14.tar.gz
HeartRate Game: QML revamp
This patch implements proper QML module registration for both CMake and qmake. It also tries to address all qmllint warnings, which results in a major refactoring, because the current approach with Loaders provides a lot of unqualified access warnings. The new approach uses StackLayout to switch between different pages. Task-number: QTBUG-111972 Pick-to: 6.5 6.5.0 Change-Id: Icc0122deebe63af16dd53c47690f2dc9fb88c919 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'examples/bluetooth/heartrate-game/StatsLabel.qml')
-rw-r--r--examples/bluetooth/heartrate-game/StatsLabel.qml34
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/bluetooth/heartrate-game/StatsLabel.qml b/examples/bluetooth/heartrate-game/StatsLabel.qml
new file mode 100644
index 00000000..0ea4249a
--- /dev/null
+++ b/examples/bluetooth/heartrate-game/StatsLabel.qml
@@ -0,0 +1,34 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+
+Item {
+ height: GameSettings.fieldHeight
+ width: parent.width
+
+ property alias title: leftText.text
+ property alias value: rightText.text
+
+ Text {
+ id: leftText
+ anchors.left: parent.left
+ height: parent.height
+ width: parent.width * 0.45
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: GameSettings.mediumFontSize
+ color: GameSettings.textColor
+ }
+
+ Text {
+ id: rightText
+ anchors.right: parent.right
+ height: parent.height
+ width: parent.width * 0.45
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: GameSettings.mediumFontSize
+ color: GameSettings.textColor
+ }
+}