diff options
-rw-r--r-- | src/plugins/platforms/ios/qiosglobal.mm | 3 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiosscreen.mm | 15 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index d26eca54e5..9abb4ba851 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -104,7 +104,8 @@ Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientat break; case UIDeviceOrientationFaceUp: case UIDeviceOrientationFaceDown: - qtOrientation = static_cast<Qt::ScreenOrientation>(-1); // not supported ATM. + // FIXME: Use cached device orientation, or fall back to interface orientation + qtOrientation = Qt::PortraitOrientation; break; default: qtOrientation = Qt::PortraitOrientation; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index b73f9c3cbc..c1613c1af4 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -83,9 +83,18 @@ - (void) orientationChanged:(NSNotification *)notification { Q_UNUSED(notification); - Qt::ScreenOrientation orientation = toQtScreenOrientation([UIDevice currentDevice].orientation); - if (orientation != -1) - QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), orientation); + + UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; + switch (deviceOrientation) { + case UIDeviceOrientationFaceUp: + case UIDeviceOrientationFaceDown: + // We ignore these events, as iOS will send events with the 'regular' + // orientations alongside these two orientations. + return; + default: + Qt::ScreenOrientation screenOrientation = toQtScreenOrientation(deviceOrientation); + QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), screenOrientation); + } } @end |