aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/chapter2-methods
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-03-23 13:22:37 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-03-23 16:52:02 +0100
commitea35d748ec16822a4b845e8e839ecd04f59ac763 (patch)
treeb8ec29de751d26f03b39035327a51dd52c529b19 /examples/declarative/extending/chapter2-methods
parent83e70cc9914a814658bfe495c6092b70e166a905 (diff)
Use pathlib in examples
Task-number: PYSIDE-1112 Change-Id: Ib99dbfb2c3889495d062b50dc9dbea04f1f78c79 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'examples/declarative/extending/chapter2-methods')
-rw-r--r--examples/declarative/extending/chapter2-methods/methods.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/declarative/extending/chapter2-methods/methods.py b/examples/declarative/extending/chapter2-methods/methods.py
index 8b9c94c62..a37376ca8 100644
--- a/examples/declarative/extending/chapter2-methods/methods.py
+++ b/examples/declarative/extending/chapter2-methods/methods.py
@@ -42,6 +42,7 @@
"""PySide6 port of the qml/tutorials/extending-qml/chapter2-methods example from Qt v5.x"""
import os
+from pathlib import Path
import sys
from PySide6.QtCore import Property, Signal, Slot, Qt, QUrl
@@ -94,8 +95,8 @@ if __name__ == '__main__':
view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
- qmlFile = os.path.join(os.path.dirname(__file__), 'app.qml')
- view.setSource(QUrl.fromLocalFile(os.path.abspath(qmlFile)))
+ qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml')
+ view.setSource(QUrl.fromLocalFile(qml_file))
if view.status() == QQuickView.Error:
sys.exit(-1)
view.show()