aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2025-09-11 16:06:11 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2025-09-15 16:34:14 +0200
commit5b19e261d5a4d6c28ad25f4bb29a0d5abcd1c947 (patch)
treecddfcf6acf26b6f851ba976d8046a493980fa7fd /examples/qml/tutorials/extending-qml/chapter1-basics/basics.py
parent0ad827ba2f02b0b47466a81d352194c685cb02bb (diff)
Update the QML basic extending tutorials
Adapt to qtdeclarative/bb6cde5229bd15f6e233262ae46fffeda666cf3d. Pick-to: 6.10 Change-Id: Id6d7f15efbe776987a88779a769653b92d44608c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples/qml/tutorials/extending-qml/chapter1-basics/basics.py')
-rw-r--r--examples/qml/tutorials/extending-qml/chapter1-basics/basics.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py b/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py
index 322bef954..08fa91c14 100644
--- a/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py
+++ b/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py
@@ -4,11 +4,10 @@ from __future__ import annotations
"""PySide6 port of the qml/tutorials/extending-qml/chapter1-basics example from Qt v5.x"""
-import os
from pathlib import Path
import sys
-from PySide6.QtCore import Property, Signal, QUrl
+from PySide6.QtCore import Property, Signal
from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
from PySide6.QtQml import QmlElement
from PySide6.QtQuick import QQuickPaintedItem, QQuickView
@@ -57,8 +56,8 @@ if __name__ == '__main__':
view = QQuickView()
view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView)
- qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
+ view.engine().addImportPath(Path(__file__).parent)
+ view.loadFromModule("Charts", "App")
if view.status() == QQuickView.Status.Error:
sys.exit(-1)
view.show()