aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/usingmodel
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/usingmodel
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/usingmodel')
-rw-r--r--examples/declarative/usingmodel/usingmodel.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/declarative/usingmodel/usingmodel.py b/examples/declarative/usingmodel/usingmodel.py
index a32945a25..7c54cc49e 100644
--- a/examples/declarative/usingmodel/usingmodel.py
+++ b/examples/declarative/usingmodel/usingmodel.py
@@ -40,6 +40,7 @@
#############################################################################
import os
+from pathlib import Path
import sys
from PySide6.QtCore import QAbstractListModel, Qt, QUrl, QByteArray
from PySide6.QtGui import QGuiApplication
@@ -86,8 +87,8 @@ if __name__ == '__main__':
myModel.populate()
view.rootContext().setContextProperty("myModel", myModel)
- qmlFile = os.path.join(os.path.dirname(__file__), 'view.qml')
- view.setSource(QUrl.fromLocalFile(os.path.abspath(qmlFile)))
+ qml_file = os.fspath(Path(__file__).resolve().parent / 'view.qml')
+ view.setSource(QUrl.fromLocalFile(qml_file))
if view.status() == QQuickView.Error:
sys.exit(-1)
view.show()