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/methods/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/qml/referenceexamples/methods/main.py') diff --git a/examples/qml/referenceexamples/methods/main.py b/examples/qml/referenceexamples/methods/main.py index 31748ff2b..5f51ebe1f 100644 --- a/examples/qml/referenceexamples/methods/main.py +++ b/examples/qml/referenceexamples/methods/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 @@ -14,10 +14,10 @@ from birthdayparty import BirthdayParty 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") party = component.create() if not party: print(component.errors()) -- cgit v1.2.3