aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/referenceexamples/default
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml/referenceexamples/default')
-rw-r--r--examples/qml/referenceexamples/default/People/Main.qml (renamed from examples/qml/referenceexamples/default/example.qml)2
-rw-r--r--examples/qml/referenceexamples/default/People/qmldir3
-rw-r--r--examples/qml/referenceexamples/default/birthdayparty.py2
-rw-r--r--examples/qml/referenceexamples/default/default.pyproject3
-rw-r--r--examples/qml/referenceexamples/default/main.py10
-rw-r--r--examples/qml/referenceexamples/default/person.py2
6 files changed, 13 insertions, 9 deletions
diff --git a/examples/qml/referenceexamples/default/example.qml b/examples/qml/referenceexamples/default/People/Main.qml
index 435be7860..9971a2315 100644
--- a/examples/qml/referenceexamples/default/example.qml
+++ b/examples/qml/referenceexamples/default/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.default.people
+import People
BirthdayParty {
host: Boy {
diff --git a/examples/qml/referenceexamples/default/People/qmldir b/examples/qml/referenceexamples/default/People/qmldir
new file mode 100644
index 000000000..a2bd9515a
--- /dev/null
+++ b/examples/qml/referenceexamples/default/People/qmldir
@@ -0,0 +1,3 @@
+module People
+typeinfo coercion.qmltypes
+Main 1.0 Main.qml
diff --git a/examples/qml/referenceexamples/default/birthdayparty.py b/examples/qml/referenceexamples/default/birthdayparty.py
index 3c13ca6cf..8c6f7e8fb 100644
--- a/examples/qml/referenceexamples/default/birthdayparty.py
+++ b/examples/qml/referenceexamples/default/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.default.people"
+QML_IMPORT_NAME = "People"
QML_IMPORT_MAJOR_VERSION = 1
diff --git a/examples/qml/referenceexamples/default/default.pyproject b/examples/qml/referenceexamples/default/default.pyproject
index 3c01c40c2..09942ebcc 100644
--- a/examples/qml/referenceexamples/default/default.pyproject
+++ b/examples/qml/referenceexamples/default/default.pyproject
@@ -1,3 +1,4 @@
{
- "files": ["main.py", "birthdayparty.py", "person.py", "example.qml"]
+ "files": ["main.py", "birthdayparty.py", "person.py",
+ "People/Main.qml", "People/qmldir"]
}
diff --git a/examples/qml/referenceexamples/default/main.py b/examples/qml/referenceexamples/default/main.py
index a4ce2f08a..f469538b6 100644
--- a/examples/qml/referenceexamples/default/main.py
+++ b/examples/qml/referenceexamples/default/main.py
@@ -1,12 +1,12 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-"""PySide6 port of the qml/examples/qml/referenceexamples/default example from Qt v6.x"""
+"""PySide6 port of the qml/examples/qml/tutorials/extending-qml-advanced/default advanced3-Default-properties example from Qt v6.x"""
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 Boy, Girl
@@ -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())
diff --git a/examples/qml/referenceexamples/default/person.py b/examples/qml/referenceexamples/default/person.py
index 7164bd645..89844c87f 100644
--- a/examples/qml/referenceexamples/default/person.py
+++ b/examples/qml/referenceexamples/default/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.default.people"
+QML_IMPORT_NAME = "People"
QML_IMPORT_MAJOR_VERSION = 1