aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/referenceexamples/properties
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml/referenceexamples/properties')
-rw-r--r--examples/qml/referenceexamples/properties/People/Main.qml (renamed from examples/qml/referenceexamples/properties/example.qml)2
-rw-r--r--examples/qml/referenceexamples/properties/People/qmldir3
-rw-r--r--examples/qml/referenceexamples/properties/birthdayparty.py2
-rw-r--r--examples/qml/referenceexamples/properties/doc/properties.rst2
-rw-r--r--examples/qml/referenceexamples/properties/main.py8
-rw-r--r--examples/qml/referenceexamples/properties/person.py2
-rw-r--r--examples/qml/referenceexamples/properties/properties.pyproject6
7 files changed, 13 insertions, 12 deletions
diff --git a/examples/qml/referenceexamples/properties/example.qml b/examples/qml/referenceexamples/properties/People/Main.qml
index 1486a0f92..0600b3557 100644
--- a/examples/qml/referenceexamples/properties/example.qml
+++ b/examples/qml/referenceexamples/properties/People/Main.qml
@@ -1,7 +1,7 @@
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import examples.properties.people
+import People
BirthdayParty {
host: Person {
diff --git a/examples/qml/referenceexamples/properties/People/qmldir b/examples/qml/referenceexamples/properties/People/qmldir
new file mode 100644
index 000000000..a2bd9515a
--- /dev/null
+++ b/examples/qml/referenceexamples/properties/People/qmldir
@@ -0,0 +1,3 @@
+module People
+typeinfo coercion.qmltypes
+Main 1.0 Main.qml
diff --git a/examples/qml/referenceexamples/properties/birthdayparty.py b/examples/qml/referenceexamples/properties/birthdayparty.py
index 1a115101b..47dddc85d 100644
--- a/examples/qml/referenceexamples/properties/birthdayparty.py
+++ b/examples/qml/referenceexamples/properties/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.properties.people"
+QML_IMPORT_NAME = "People"
QML_IMPORT_MAJOR_VERSION = 1
diff --git a/examples/qml/referenceexamples/properties/doc/properties.rst b/examples/qml/referenceexamples/properties/doc/properties.rst
index 909434c3c..fd0c6d474 100644
--- a/examples/qml/referenceexamples/properties/doc/properties.rst
+++ b/examples/qml/referenceexamples/properties/doc/properties.rst
@@ -40,7 +40,7 @@ The BirthdayParty class is declared like this:
# To be used on the @QmlElement decorator
# (QML_IMPORT_MINOR_VERSION is optional)
- QML_IMPORT_NAME = "examples.properties.people"
+ QML_IMPORT_NAME = "People"
QML_IMPORT_MAJOR_VERSION = 1
diff --git a/examples/qml/referenceexamples/properties/main.py b/examples/qml/referenceexamples/properties/main.py
index a980b25aa..4797e4c7c 100644
--- a/examples/qml/referenceexamples/properties/main.py
+++ b/examples/qml/referenceexamples/properties/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
@@ -16,10 +16,10 @@ from birthdayparty import BirthdayParty
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 party:
diff --git a/examples/qml/referenceexamples/properties/person.py b/examples/qml/referenceexamples/properties/person.py
index 4cc54260a..fafb9d581 100644
--- a/examples/qml/referenceexamples/properties/person.py
+++ b/examples/qml/referenceexamples/properties/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.properties.people"
+QML_IMPORT_NAME = "People"
QML_IMPORT_MAJOR_VERSION = 1
diff --git a/examples/qml/referenceexamples/properties/properties.pyproject b/examples/qml/referenceexamples/properties/properties.pyproject
index 0f5958fc3..adb34b2d0 100644
--- a/examples/qml/referenceexamples/properties/properties.pyproject
+++ b/examples/qml/referenceexamples/properties/properties.pyproject
@@ -1,6 +1,4 @@
{
- "files": ["example.qml",
- "main.py",
- "person.py",
- "birthdayparty.py"]
+ "files": ["main.py", "person.py", "birthdayparty.py",
+ "People/Main.qml", "People/qmldir"]
}