aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-05-05 16:26:46 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-05-09 18:01:08 +0000
commit44993bcaca283ce6896f7c7cdb97a2e0176368be (patch)
tree97b4a760308018ddfdbf90eac3f7bcaa4c39285c /examples
parent45ba07e3145dc0977383b1a0633e72eda4270ffd (diff)
Bluetooth/Heartrate game example: Port to use loadFromModule()
Adapt to recent changes in the example. Task-number: PYSIDE-2206 Task-number: QTBUG-111972 Change-Id: I92562ca34c70c57bff583bc620a734098ae0dea3 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> (cherry picked from commit 7b547bd786d3f37e900d24468d33467ac4681b91) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/App.qml (renamed from examples/bluetooth/heartrate_game/qml/App.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/BluetoothAlarmDialog.qml (renamed from examples/bluetooth/heartrate_game/qml/BluetoothAlarmDialog.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/BottomLine.qml (renamed from examples/bluetooth/heartrate_game/qml/BottomLine.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/Connect.qml (renamed from examples/bluetooth/heartrate_game/qml/Connect.qml)2
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/GameButton.qml (renamed from examples/bluetooth/heartrate_game/qml/GameButton.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/GamePage.qml (renamed from examples/bluetooth/heartrate_game/qml/GamePage.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/GameSettings.qml (renamed from examples/bluetooth/heartrate_game/qml/GameSettings.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/Main.qml (renamed from examples/bluetooth/heartrate_game/qml/main.qml)1
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/Measure.qml (renamed from examples/bluetooth/heartrate_game/qml/Measure.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/SplashScreen.qml (renamed from examples/bluetooth/heartrate_game/qml/SplashScreen.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/Stats.qml (renamed from examples/bluetooth/heartrate_game/qml/Stats.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/StatsLabel.qml (renamed from examples/bluetooth/heartrate_game/qml/StatsLabel.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/TitleBar.qml (renamed from examples/bluetooth/heartrate_game/qml/TitleBar.qml)0
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/images/bt_off_to_on.png (renamed from examples/bluetooth/heartrate_game/qml/images/bt_off_to_on.png)bin6143 -> 6143 bytes
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/images/heart.png (renamed from examples/bluetooth/heartrate_game/qml/images/heart.png)bin2664 -> 2664 bytes
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/images/logo.png (renamed from examples/bluetooth/heartrate_game/qml/images/logo.png)bin31915 -> 31915 bytes
-rw-r--r--examples/bluetooth/heartrate_game/HeartRateGame/qmldir14
-rw-r--r--examples/bluetooth/heartrate_game/connectionhandler.py2
-rw-r--r--examples/bluetooth/heartrate_game/devicefinder.py2
-rw-r--r--examples/bluetooth/heartrate_game/devicehandler.py2
-rw-r--r--examples/bluetooth/heartrate_game/heartrate_game.pyproject27
-rw-r--r--examples/bluetooth/heartrate_game/main.py8
-rw-r--r--examples/bluetooth/heartrate_game/qml/qmldir1
23 files changed, 36 insertions, 23 deletions
diff --git a/examples/bluetooth/heartrate_game/qml/App.qml b/examples/bluetooth/heartrate_game/HeartRateGame/App.qml
index 1eb532021..1eb532021 100644
--- a/examples/bluetooth/heartrate_game/qml/App.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/App.qml
diff --git a/examples/bluetooth/heartrate_game/qml/BluetoothAlarmDialog.qml b/examples/bluetooth/heartrate_game/HeartRateGame/BluetoothAlarmDialog.qml
index 0be61e4f8..0be61e4f8 100644
--- a/examples/bluetooth/heartrate_game/qml/BluetoothAlarmDialog.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/BluetoothAlarmDialog.qml
diff --git a/examples/bluetooth/heartrate_game/qml/BottomLine.qml b/examples/bluetooth/heartrate_game/HeartRateGame/BottomLine.qml
index caebc307e..caebc307e 100644
--- a/examples/bluetooth/heartrate_game/qml/BottomLine.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/BottomLine.qml
diff --git a/examples/bluetooth/heartrate_game/qml/Connect.qml b/examples/bluetooth/heartrate_game/HeartRateGame/Connect.qml
index d9ebbdc51..abcfb4ce9 100644
--- a/examples/bluetooth/heartrate_game/qml/Connect.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/Connect.qml
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
-import Shared
+import "."
GamePage {
diff --git a/examples/bluetooth/heartrate_game/qml/GameButton.qml b/examples/bluetooth/heartrate_game/HeartRateGame/GameButton.qml
index 3ce9d66fd..3ce9d66fd 100644
--- a/examples/bluetooth/heartrate_game/qml/GameButton.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/GameButton.qml
diff --git a/examples/bluetooth/heartrate_game/qml/GamePage.qml b/examples/bluetooth/heartrate_game/HeartRateGame/GamePage.qml
index 25a5bb3d1..25a5bb3d1 100644
--- a/examples/bluetooth/heartrate_game/qml/GamePage.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/GamePage.qml
diff --git a/examples/bluetooth/heartrate_game/qml/GameSettings.qml b/examples/bluetooth/heartrate_game/HeartRateGame/GameSettings.qml
index f265b73c3..f265b73c3 100644
--- a/examples/bluetooth/heartrate_game/qml/GameSettings.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/GameSettings.qml
diff --git a/examples/bluetooth/heartrate_game/qml/main.qml b/examples/bluetooth/heartrate_game/HeartRateGame/Main.qml
index 44d824faf..50b7d3fbb 100644
--- a/examples/bluetooth/heartrate_game/qml/main.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/Main.qml
@@ -4,7 +4,6 @@
import QtQuick
import QtQuick.Window
import "."
-import Shared
Window {
id: wroot
diff --git a/examples/bluetooth/heartrate_game/qml/Measure.qml b/examples/bluetooth/heartrate_game/HeartRateGame/Measure.qml
index c434d5114..c434d5114 100644
--- a/examples/bluetooth/heartrate_game/qml/Measure.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/Measure.qml
diff --git a/examples/bluetooth/heartrate_game/qml/SplashScreen.qml b/examples/bluetooth/heartrate_game/HeartRateGame/SplashScreen.qml
index 23f71f08f..23f71f08f 100644
--- a/examples/bluetooth/heartrate_game/qml/SplashScreen.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/SplashScreen.qml
diff --git a/examples/bluetooth/heartrate_game/qml/Stats.qml b/examples/bluetooth/heartrate_game/HeartRateGame/Stats.qml
index b818e85e4..b818e85e4 100644
--- a/examples/bluetooth/heartrate_game/qml/Stats.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/Stats.qml
diff --git a/examples/bluetooth/heartrate_game/qml/StatsLabel.qml b/examples/bluetooth/heartrate_game/HeartRateGame/StatsLabel.qml
index cd5cda5be..cd5cda5be 100644
--- a/examples/bluetooth/heartrate_game/qml/StatsLabel.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/StatsLabel.qml
diff --git a/examples/bluetooth/heartrate_game/qml/TitleBar.qml b/examples/bluetooth/heartrate_game/HeartRateGame/TitleBar.qml
index b7de77c4b..b7de77c4b 100644
--- a/examples/bluetooth/heartrate_game/qml/TitleBar.qml
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/TitleBar.qml
diff --git a/examples/bluetooth/heartrate_game/qml/images/bt_off_to_on.png b/examples/bluetooth/heartrate_game/HeartRateGame/images/bt_off_to_on.png
index 5ea1f3f06..5ea1f3f06 100644
--- a/examples/bluetooth/heartrate_game/qml/images/bt_off_to_on.png
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/images/bt_off_to_on.png
Binary files differ
diff --git a/examples/bluetooth/heartrate_game/qml/images/heart.png b/examples/bluetooth/heartrate_game/HeartRateGame/images/heart.png
index f2b3c0a3e..f2b3c0a3e 100644
--- a/examples/bluetooth/heartrate_game/qml/images/heart.png
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/images/heart.png
Binary files differ
diff --git a/examples/bluetooth/heartrate_game/qml/images/logo.png b/examples/bluetooth/heartrate_game/HeartRateGame/images/logo.png
index ea0af7e00..ea0af7e00 100644
--- a/examples/bluetooth/heartrate_game/qml/images/logo.png
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/images/logo.png
Binary files differ
diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/qmldir b/examples/bluetooth/heartrate_game/HeartRateGame/qmldir
new file mode 100644
index 000000000..2baa74a92
--- /dev/null
+++ b/examples/bluetooth/heartrate_game/HeartRateGame/qmldir
@@ -0,0 +1,14 @@
+module HeartRateGame
+App 1.0 App.qml
+BluetoothAlarmDialog 1.0 BluetoothAlarmDialog.qml
+BottomLine 1.0 BottomLine.qml
+Connect 1.0 Connect.qml
+GameButton 1.0 GameButton.qml
+GamePage 1.0 GamePage.qml
+singleton GameSettings 1.0 GameSettings.qml
+Measure 1.0 Measure.qml
+SplashScreen 1.0 SplashScreen.qml
+Stats 1.0 Stats.qml
+StatsLabel 1.0 StatsLabel.qml
+TitleBar 1.0 TitleBar.qml
+Main 1.0 Main.qml
diff --git a/examples/bluetooth/heartrate_game/connectionhandler.py b/examples/bluetooth/heartrate_game/connectionhandler.py
index 5bd7bfbb2..f631ecdb3 100644
--- a/examples/bluetooth/heartrate_game/connectionhandler.py
+++ b/examples/bluetooth/heartrate_game/connectionhandler.py
@@ -11,7 +11,7 @@ from heartrate_global import simulator
# To be used on the @QmlElement decorator
# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "Shared"
+QML_IMPORT_NAME = "HeartRateGame"
QML_IMPORT_MAJOR_VERSION = 1
diff --git a/examples/bluetooth/heartrate_game/devicefinder.py b/examples/bluetooth/heartrate_game/devicefinder.py
index c69f8ab89..7bb9cb20b 100644
--- a/examples/bluetooth/heartrate_game/devicefinder.py
+++ b/examples/bluetooth/heartrate_game/devicefinder.py
@@ -12,7 +12,7 @@ from heartrate_global import simulator
# To be used on the @QmlElement decorator
# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "Shared"
+QML_IMPORT_NAME = "HeartRateGame"
QML_IMPORT_MAJOR_VERSION = 1
diff --git a/examples/bluetooth/heartrate_game/devicehandler.py b/examples/bluetooth/heartrate_game/devicehandler.py
index 421102b28..31f31a1bf 100644
--- a/examples/bluetooth/heartrate_game/devicehandler.py
+++ b/examples/bluetooth/heartrate_game/devicehandler.py
@@ -20,7 +20,7 @@ from heartrate_global import simulator
# To be used on the @QmlElement decorator
# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "Shared"
+QML_IMPORT_NAME = "HeartRateGame"
QML_IMPORT_MAJOR_VERSION = 1
diff --git a/examples/bluetooth/heartrate_game/heartrate_game.pyproject b/examples/bluetooth/heartrate_game/heartrate_game.pyproject
index e4c40874a..94b7e3978 100644
--- a/examples/bluetooth/heartrate_game/heartrate_game.pyproject
+++ b/examples/bluetooth/heartrate_game/heartrate_game.pyproject
@@ -6,17 +6,18 @@
"devicehandler.py",
"deviceinfo.py",
"heartrate_global.py",
- "qml/main.qml",
- "qml/App.qml",
- "qml/BluetoothAlarmDialog.qml",
- "qml/BottomLine.qml",
- "qml/Connect.qml",
- "qml/GameButton.qml",
- "qml/GamePage.qml",
- "qml/GameSettings.qml",
- "qml/Measure.qml",
- "qml/SplashScreen.qml",
- "qml/Stats.qml",
- "qml/StatsLabel.qml",
- "qml/TitleBar.qml"]
+ "HeartRateGame/qmldir",
+ "HeartRateGame/Main.qml",
+ "HeartRateGame/App.qml",
+ "HeartRateGame/BluetoothAlarmDialog.qml",
+ "HeartRateGame/BottomLine.qml",
+ "HeartRateGame/Connect.qml",
+ "HeartRateGame/GameButton.qml",
+ "HeartRateGame/GamePage.qml",
+ "HeartRateGame/GameSettings.qml",
+ "HeartRateGame/Measure.qml",
+ "HeartRateGame/SplashScreen.qml",
+ "HeartRateGame/Stats.qml",
+ "HeartRateGame/StatsLabel.qml",
+ "HeartRateGame/TitleBar.qml"]
}
diff --git a/examples/bluetooth/heartrate_game/main.py b/examples/bluetooth/heartrate_game/main.py
index 58f5f4ef8..684d7dbca 100644
--- a/examples/bluetooth/heartrate_game/main.py
+++ b/examples/bluetooth/heartrate_game/main.py
@@ -3,14 +3,13 @@
"""PySide6 port of the bluetooth/heartrate-game example from Qt v6.x"""
-import os
from pathlib import Path
import sys
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from PySide6.QtQml import QQmlApplicationEngine
from PySide6.QtGui import QGuiApplication
-from PySide6.QtCore import QCoreApplication, QLoggingCategory, QUrl
+from PySide6.QtCore import QCoreApplication, QLoggingCategory
from connectionhandler import ConnectionHandler
from devicefinder import DeviceFinder
@@ -43,8 +42,9 @@ if __name__ == '__main__':
"deviceFinder": deviceFinder,
"deviceHandler": deviceHandler})
- qml_file = os.fspath(Path(__file__).resolve().parent / "qml" / "main.qml")
- engine.load(QUrl.fromLocalFile(qml_file))
+ engine.addImportPath(Path(__file__).parent)
+ engine.loadFromModule("HeartRateGame", "Main");
+
if not engine.rootObjects():
sys.exit(-1)
diff --git a/examples/bluetooth/heartrate_game/qml/qmldir b/examples/bluetooth/heartrate_game/qml/qmldir
deleted file mode 100644
index 5e0d2b540..000000000
--- a/examples/bluetooth/heartrate_game/qml/qmldir
+++ /dev/null
@@ -1 +0,0 @@
-singleton GameSettings 1.0 GameSettings.qml