diff options
Diffstat (limited to 'examples/declarative/signals')
-rwxr-xr-x | examples/declarative/signals/pytoqml1/main.py | 6 | ||||
-rwxr-xr-x | examples/declarative/signals/qmltopy1/main.py | 6 | ||||
-rwxr-xr-x | examples/declarative/signals/qmltopy2/main.py | 6 | ||||
-rwxr-xr-x | examples/declarative/signals/qmltopy3/main.py | 6 | ||||
-rwxr-xr-x | examples/declarative/signals/qmltopy4/main.py | 6 |
5 files changed, 25 insertions, 5 deletions
diff --git a/examples/declarative/signals/pytoqml1/main.py b/examples/declarative/signals/pytoqml1/main.py index 0ca1ffe..92f94fe 100755 --- a/examples/declarative/signals/pytoqml1/main.py +++ b/examples/declarative/signals/pytoqml1/main.py @@ -42,6 +42,7 @@ from __future__ import print_function +import os import sys from PySide2.QtCore import QTimer, QUrl from PySide2.QtGui import QGuiApplication @@ -55,7 +56,10 @@ if __name__ == '__main__': timer.start(2000) view = QQuickView() - view.setSource(QUrl('view.qml')) + qmlFile = os.path.join(os.path.dirname(__file__), 'view.qml') + view.setSource(QUrl.fromLocalFile(qmlFile)) + if view.status() == QQuickView.Error: + sys.exit(-1) root = view.rootObject() timer.timeout.connect(root.updateRotater) diff --git a/examples/declarative/signals/qmltopy1/main.py b/examples/declarative/signals/qmltopy1/main.py index 1ce0507..683169e 100755 --- a/examples/declarative/signals/qmltopy1/main.py +++ b/examples/declarative/signals/qmltopy1/main.py @@ -42,6 +42,7 @@ from __future__ import print_function +import os import sys from PySide2.QtCore import QObject, QUrl, Slot from PySide2.QtGui import QGuiApplication @@ -76,7 +77,10 @@ if __name__ == '__main__': context = view.rootContext() context.setContextProperty("con", con) - view.setSource(QUrl('view.qml')) + qmlFile = os.path.join(os.path.dirname(__file__), 'view.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/signals/qmltopy2/main.py b/examples/declarative/signals/qmltopy2/main.py index 2526ede..bb84f27 100755 --- a/examples/declarative/signals/qmltopy2/main.py +++ b/examples/declarative/signals/qmltopy2/main.py @@ -42,6 +42,7 @@ from __future__ import print_function +import os import sys from PySide2.QtCore import QObject, QUrl, Slot from PySide2.QtGui import QGuiApplication @@ -68,7 +69,10 @@ if __name__ == '__main__': context = view.rootContext() context.setContextProperty("rotatevalue", rotatevalue) - view.setSource(QUrl('view.qml')) + qmlFile = os.path.join(os.path.dirname(__file__), 'view.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/signals/qmltopy3/main.py b/examples/declarative/signals/qmltopy3/main.py index f2ddd49..c78c77a 100755 --- a/examples/declarative/signals/qmltopy3/main.py +++ b/examples/declarative/signals/qmltopy3/main.py @@ -42,6 +42,7 @@ from __future__ import print_function +import os import sys from PySide2.QtCore import QObject, QUrl from PySide2.QtGui import QGuiApplication @@ -54,7 +55,10 @@ def sayThis(s): if __name__ == '__main__': app = QGuiApplication(sys.argv) view = QQuickView() - view.setSource(QUrl('view.qml')) + qmlFile = os.path.join(os.path.dirname(__file__), 'view.qml') + view.setSource(QUrl.fromLocalFile(qmlFile)) + if view.status() == QQuickView.Error: + sys.exit(-1) root = view.rootObject() root.textRotationChanged.connect(sayThis) diff --git a/examples/declarative/signals/qmltopy4/main.py b/examples/declarative/signals/qmltopy4/main.py index fb6fc3e..9eb9d41 100755 --- a/examples/declarative/signals/qmltopy4/main.py +++ b/examples/declarative/signals/qmltopy4/main.py @@ -42,6 +42,7 @@ from __future__ import print_function +import os import sys from PySide2.QtCore import QObject, QUrl from PySide2.QtGui import QGuiApplication @@ -54,7 +55,10 @@ def sayThis(s): if __name__ == '__main__': app = QGuiApplication(sys.argv) view = QQuickView() - view.setSource(QUrl('view.qml')) + qmlFile = os.path.join(os.path.dirname(__file__), 'view.qml') + view.setSource(QUrl.fromLocalFile(qmlFile)) + if view.status() == QQuickView.Error: + sys.exit(-1) root = view.rootObject() button = root.findChild(QObject, "buttonMouseArea") |