diff options
Diffstat (limited to 'examples/declarative/extending/chapter2-methods/methods.py')
-rw-r--r-- | examples/declarative/extending/chapter2-methods/methods.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/declarative/extending/chapter2-methods/methods.py b/examples/declarative/extending/chapter2-methods/methods.py index 847d5e5..f9bd6d3 100644 --- a/examples/declarative/extending/chapter2-methods/methods.py +++ b/examples/declarative/extending/chapter2-methods/methods.py @@ -93,7 +93,10 @@ if __name__ == '__main__': view = QQuickView() view.setResizeMode(QQuickView.SizeRootObjectToView) - view.setSource(QUrl.fromLocalFile('app.qml')) + qmlFile = os.path.join(os.path.dirname(__file__), 'app.qml') + view.setSource(QUrl.fromLocalFile(qmlFile)) + if view.status() == QQuickView.Error: + sys.exit(-1) view.show() res = app.exec_() # Deleting the view before it goes out of scope is required to make sure all child QML instances |