diff options
Diffstat (limited to 'examples/declarative/extending')
5 files changed, 20 insertions, 5 deletions
diff --git a/examples/declarative/extending/chapter1-basics/basics.py b/examples/declarative/extending/chapter1-basics/basics.py index 64d7ad0..2ed02fd 100644 --- a/examples/declarative/extending/chapter1-basics/basics.py +++ b/examples/declarative/extending/chapter1-basics/basics.py @@ -88,7 +88,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 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 diff --git a/examples/declarative/extending/chapter3-bindings/bindings.py b/examples/declarative/extending/chapter3-bindings/bindings.py index 47e02a6..e87d3f4 100644 --- a/examples/declarative/extending/chapter3-bindings/bindings.py +++ b/examples/declarative/extending/chapter3-bindings/bindings.py @@ -98,7 +98,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 diff --git a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py index 4b936fa..fd94991 100644 --- a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py +++ b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py @@ -103,7 +103,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 diff --git a/examples/declarative/extending/chapter5-listproperties/listproperties.py b/examples/declarative/extending/chapter5-listproperties/listproperties.py index a6b270b..718691f 100644 --- a/examples/declarative/extending/chapter5-listproperties/listproperties.py +++ b/examples/declarative/extending/chapter5-listproperties/listproperties.py @@ -116,7 +116,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 |