@@ -17,6 +17,8 @@
1717import QtQuick 2.4
1818
1919QtObject {
20+ id: root
21+
2022 // Just because "native" is a reserved keyword :(
2123 property int native_: Qt.PortraitOrientation
2224
@@ -26,4 +28,30 @@ QtObject {
2628 property int invertedLandscape: Qt.InvertedLandscapeOrientation
2729 property int portrait: Qt.PortraitOrientation
2830 property int invertedPortrait: Qt.InvertedPortraitOrientation
31+
32+ function map(orientations) {
33+ var result = 0;
34+
35+ if (orientations & Qt.PortraitOrientation) {
36+ result |= root.portrait;
37+ }
38+
39+ if (orientations & Qt.InvertedPortraitOrientation) {
40+ result |= root.invertedPortrait;
41+ }
42+
43+ if (orientations & Qt.LandscapeOrientation) {
44+ result |= root.landscape;
45+ }
46+
47+ if (orientations & Qt.InvertedLandscapeOrientation) {
48+ result |= root.invertedLandscape;
49+ }
50+
51+ if (result == 0) {
52+ result = root.primary;
53+ }
54+
55+ return result;
56+ }
2957}