From 5289f4526e48f857cce44bf71023483278155d2c Mon Sep 17 00:00:00 2001 From: Stefan Wildemann Date: Tue, 16 May 2017 11:58:55 +0200 Subject: Fix: Make rotating compatible to Qt 5.2 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. --- navit/graphics/qt5/loader.qml | 9 +++++++-- 1 file 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; + } + } } } -- cgit v1.2.1