summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wildemann <gta04@metalstrolche.de>2017-05-16 11:58:55 +0200
committerStefan Wildemann <gta04@metalstrolche.de>2017-05-16 12:06:32 +0200
commit5289f4526e48f857cce44bf71023483278155d2c (patch)
tree0838a6dbf04835fdf615aadb4bb1499e579d43fc
parent1e71b5fd4c0bf5ac96e5207c51db7d17057ed798 (diff)
downloadnavit-qt5_qml_rotate.tar.gz
Fix: Make rotating compatible to Qt 5.2qt5_qml_rotate
Welcome to Qt5 compatibility hell. Seems like the Screen.orientationUpdateMask property is only valid from Qt5.4 and beyond. To make this compatible down to Qt5.2, i introduce a QML JavaScript workaround/hack.
-rw-r--r--navit/graphics/qt5/loader.qml9
1 files changed, 7 insertions, 2 deletions
diff --git a/navit/graphics/qt5/loader.qml b/navit/graphics/qt5/loader.qml
index ed9425bf7..9882cb23a 100644
--- a/navit/graphics/qt5/loader.qml
+++ b/navit/graphics/qt5/loader.qml
@@ -5,8 +5,6 @@ import QtQuick.Window 2.0
Window {
width: 200; height: 200
- Screen.orientationUpdateMask: Qt.PortraitOrientation + Qt.LandscapeOrientation + Qt.InvertedPortraitOrientation + Qt.InvertedLandscapeOrientation
-
Item {
id: root
anchors.fill: parent
@@ -35,5 +33,12 @@ Window {
source: "graphics_qt5.qml"
objectName: "navit_loader"
}
+ Component.onCompleted: {
+ // orientation update mask is defined since QML 5.4 So make this compatible to 5.2
+ // by just calling this if available
+ if(Screen.hasOwnProperty('orientationUpdateMask')) {
+ Screen.orientationUpdateMask = Qt.PortraitOrientation + Qt.LandscapeOrientation + Qt.InvertedPortraitOrientation + Qt.InvertedLandscapeOrientation;
+ }
+ }
}
}