diff options
Diffstat (limited to 'examples/qml/referenceexamples/adding')
| -rw-r--r-- | examples/qml/referenceexamples/adding/People/Main.qml (renamed from examples/qml/referenceexamples/adding/example.qml) | 2 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/adding/People/qmldir | 3 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/adding/adding.pyproject | 5 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/adding/doc/adding.rst | 2 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/adding/main.py | 8 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/adding/person.py | 2 |
6 files changed, 12 insertions, 10 deletions
diff --git a/examples/qml/referenceexamples/adding/example.qml b/examples/qml/referenceexamples/adding/People/Main.qml index 42d47dea9..8d963a861 100644 --- a/examples/qml/referenceexamples/adding/example.qml +++ b/examples/qml/referenceexamples/adding/People/Main.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import examples.adding.people +import People Person { name: "Bob Jones" diff --git a/examples/qml/referenceexamples/adding/People/qmldir b/examples/qml/referenceexamples/adding/People/qmldir new file mode 100644 index 000000000..a2bd9515a --- /dev/null +++ b/examples/qml/referenceexamples/adding/People/qmldir @@ -0,0 +1,3 @@ +module People +typeinfo coercion.qmltypes +Main 1.0 Main.qml diff --git a/examples/qml/referenceexamples/adding/adding.pyproject b/examples/qml/referenceexamples/adding/adding.pyproject index 46df4b253..3219f79ca 100644 --- a/examples/qml/referenceexamples/adding/adding.pyproject +++ b/examples/qml/referenceexamples/adding/adding.pyproject @@ -1,5 +1,4 @@ { - "files": ["example.qml", - "main.py", - "person.py"] + "files": ["main.py", "person.py", + "People/Main.qml", "People/qmldir"] } diff --git a/examples/qml/referenceexamples/adding/doc/adding.rst b/examples/qml/referenceexamples/adding/doc/adding.rst index 55f6105b7..d06ff0a5a 100644 --- a/examples/qml/referenceexamples/adding/doc/adding.rst +++ b/examples/qml/referenceexamples/adding/doc/adding.rst @@ -33,7 +33,7 @@ return members of the object instance. # To be used on the @QmlElement decorator # (QML_IMPORT_MINOR_VERSION is optional) - QML_IMPORT_NAME = "examples.adding.people" + QML_IMPORT_NAME = "People" QML_IMPORT_MAJOR_VERSION = 1 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: diff --git a/examples/qml/referenceexamples/adding/person.py b/examples/qml/referenceexamples/adding/person.py index 0c2b5b124..fafb9d581 100644 --- a/examples/qml/referenceexamples/adding/person.py +++ b/examples/qml/referenceexamples/adding/person.py @@ -6,7 +6,7 @@ from PySide6.QtQml import QmlElement # To be used on the @QmlElement decorator # (QML_IMPORT_MINOR_VERSION is optional) -QML_IMPORT_NAME = "examples.adding.people" +QML_IMPORT_NAME = "People" QML_IMPORT_MAJOR_VERSION = 1 |
