aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py')
-rw-r--r--examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py b/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py
index ed332cba7..a3fa77ed9 100644
--- a/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py
+++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py
@@ -4,11 +4,10 @@ from __future__ import annotations
"""PySide6 port of the qml/tutorials/extending-qml/chapter3-bindings example from Qt v5.x"""
-import os
from pathlib import Path
import sys
-from PySide6.QtCore import Property, Signal, Slot, QUrl, Qt
+from PySide6.QtCore import Property, Signal, Slot, Qt
from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
from PySide6.QtQml import QmlElement
from PySide6.QtQuick import QQuickPaintedItem, QQuickView
@@ -68,8 +67,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()