From fbb22873530c200b4ddb9b2da91764948bb9da71 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 28 Apr 2023 11:47:23 +0200 Subject: Port the QML reference examples to QML module usage As a drive-by fix the example origin where applicable. Task-number: PYSIDE-2206 Task-number: QTBUG-111033 Pick-to: 6.5 Change-Id: If3b17435c17310c3f6c196f7653c7025ad359366 Reviewed-by: Shyamnath Premnadh --- examples/qml/referenceexamples/adding/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/qml/referenceexamples/adding/main.py') diff --git a/examples/qml/referenceexamples/adding/main.py b/examples/qml/referenceexamples/adding/main.py index f10b77bc1..faf13f42f 100644 --- a/examples/qml/referenceexamples/adding/main.py +++ b/examples/qml/referenceexamples/adding/main.py @@ -6,7 +6,7 @@ from pathlib import Path import sys -from PySide6.QtCore import QCoreApplication, QUrl +from PySide6.QtCore import QCoreApplication from PySide6.QtQml import QQmlComponent, QQmlEngine from person import Person @@ -15,10 +15,10 @@ from person import Person if __name__ == '__main__': app = QCoreApplication(sys.argv) - qml_file = Path(__file__).parent / "example.qml" - url = QUrl.fromLocalFile(qml_file) engine = QQmlEngine() - component = QQmlComponent(engine, url) + engine.addImportPath(Path(__file__).parent) + component = QQmlComponent(engine) + component.loadFromModule("People", "Main") person = component.create() if person: -- cgit v1.2.3