diff options
Diffstat (limited to 'examples/qml/referenceexamples/binding')
| -rw-r--r-- | examples/qml/referenceexamples/binding/People/Main.qml (renamed from examples/qml/referenceexamples/binding/example.qml) | 2 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/binding/People/qmldir | 3 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/binding/binding.pyproject | 3 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/binding/birthdayparty.py | 2 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/binding/happybirthdaysong.py | 2 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/binding/main.py | 8 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/binding/person.py | 2 |
7 files changed, 13 insertions, 9 deletions
diff --git a/examples/qml/referenceexamples/binding/example.qml b/examples/qml/referenceexamples/binding/People/Main.qml index ca0958810..75add22af 100644 --- a/examples/qml/referenceexamples/binding/example.qml +++ b/examples/qml/referenceexamples/binding/People/Main.qml @@ -1,7 +1,7 @@ // Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import examples.binding.people +import People BirthdayParty { id: theParty diff --git a/examples/qml/referenceexamples/binding/People/qmldir b/examples/qml/referenceexamples/binding/People/qmldir new file mode 100644 index 000000000..a2bd9515a --- /dev/null +++ b/examples/qml/referenceexamples/binding/People/qmldir @@ -0,0 +1,3 @@ +module People +typeinfo coercion.qmltypes +Main 1.0 Main.qml diff --git a/examples/qml/referenceexamples/binding/binding.pyproject b/examples/qml/referenceexamples/binding/binding.pyproject index a782d5c8a..fe2980fa9 100644 --- a/examples/qml/referenceexamples/binding/binding.pyproject +++ b/examples/qml/referenceexamples/binding/binding.pyproject @@ -1,3 +1,4 @@ { - "files": ["main.py", "birthdayparty.py", "happybirthdaysong.py", "person.py", "example.qml"] + "files": ["main.py", "birthdayparty.py", "happybirthdaysong.py", "person.py", + "People/Main.qml", "People/qmldir"] } diff --git a/examples/qml/referenceexamples/binding/birthdayparty.py b/examples/qml/referenceexamples/binding/birthdayparty.py index 78f0314b4..a337d4a16 100644 --- a/examples/qml/referenceexamples/binding/birthdayparty.py +++ b/examples/qml/referenceexamples/binding/birthdayparty.py @@ -9,7 +9,7 @@ from person import Person # To be used on the @QmlElement decorator # (QML_IMPORT_MINOR_VERSION is optional) -QML_IMPORT_NAME = "examples.binding.people" +QML_IMPORT_NAME = "People" QML_IMPORT_MAJOR_VERSION = 1 diff --git a/examples/qml/referenceexamples/binding/happybirthdaysong.py b/examples/qml/referenceexamples/binding/happybirthdaysong.py index 80b288d81..59ebfe4c6 100644 --- a/examples/qml/referenceexamples/binding/happybirthdaysong.py +++ b/examples/qml/referenceexamples/binding/happybirthdaysong.py @@ -6,7 +6,7 @@ from PySide6.QtQml import QmlElement, QPyQmlPropertyValueSource # To be used on the @QmlElement decorator # (QML_IMPORT_MINOR_VERSION is optional) -QML_IMPORT_NAME = "examples.binding.people" +QML_IMPORT_NAME = "People" QML_IMPORT_MAJOR_VERSION = 1 diff --git a/examples/qml/referenceexamples/binding/main.py b/examples/qml/referenceexamples/binding/main.py index dcbd547ad..738bab086 100644 --- a/examples/qml/referenceexamples/binding/main.py +++ b/examples/qml/referenceexamples/binding/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, qmlAttachedPropertiesObject from person import Boy, Girl @@ -16,10 +16,10 @@ from happybirthdaysong import HappyBirthdaySong 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") party = component.create() if not party: print(component.errors()) diff --git a/examples/qml/referenceexamples/binding/person.py b/examples/qml/referenceexamples/binding/person.py index 9e7d799e1..a6942763a 100644 --- a/examples/qml/referenceexamples/binding/person.py +++ b/examples/qml/referenceexamples/binding/person.py @@ -6,7 +6,7 @@ from PySide6.QtQml import QmlAnonymous, QmlElement # To be used on the @QmlElement decorator # (QML_IMPORT_MINOR_VERSION is optional) -QML_IMPORT_NAME = "examples.binding.people" +QML_IMPORT_NAME = "People" QML_IMPORT_MAJOR_VERSION = 1 |
