diff options
Diffstat (limited to 'examples/declarative/usingmodel')
-rw-r--r-- | examples/declarative/usingmodel/usingmodel.py | 5 |
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() |