on xenial help sign in
Fix
commiteb6d72e055905d5b988d7ec13187dcbc2b5536ec authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateThu 29 Oct 2015, 11:49 (11 years ago) parent4f727b0
3 files changed+30−1
qml/Components/Orientations.qml+28 qml/DeviceConfiguration.qml+1 qml/Shell.qml+1−1
qml/Components/Orientations.qml+28
@@ -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}
qml/DeviceConfiguration.qml+1
@@ -98,6 +98,7 @@ QtObject {
9898 PropertyChanges {
9999 target: priv
100100 landscapeOrientation: Qt.InvertedLandscapeOrientation
101+ invertedLandscapeOrientation: Qt.LandscapeOrientation
101102 primaryOrientation: Qt.InvertedLandscapeOrientation
102103 category: "tablet"
103104 }
qml/Shell.qml+1−1
@@ -85,7 +85,7 @@ Item {
8585 } else if (greeter && greeter.shown) {
8686 return Qt.PrimaryOrientation;
8787 } else if (mainApp) {
88− return mainApp.supportedOrientations;
88+ return shell.orientations.map(mainApp.supportedOrientations);
8989 } else {
9090 // we just don't care
9191 return Qt.PortraitOrientation