diff options
Diffstat (limited to 'src/plugins/platforms/ios/qioswindow.mm')
-rw-r--r-- | src/plugins/platforms/ios/qioswindow.mm | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 480062e4de..6c4614408d 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -75,6 +75,15 @@ QIOSWindow::QIOSWindow(QWindow *window) setWindowState(window->windowState()); setOpacity(window->opacity()); + + Qt::ScreenOrientation initialOrientation = window->contentOrientation(); + if (initialOrientation != Qt::PrimaryOrientation) { + // Start up in portrait, then apply possible content orientation, + // as per Apple's documentation. + dispatch_async(dispatch_get_main_queue(), ^{ + handleContentOrientationChange(initialOrientation); + }); + } } QIOSWindow::~QIOSWindow() @@ -322,10 +331,12 @@ void QIOSWindow::updateWindowLevel() void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { - // Keep the status bar in sync with content orientation. This will ensure - // that the task bar (and associated gestures) are aligned correctly: - UIInterfaceOrientation uiOrientation = UIInterfaceOrientation(fromQtScreenOrientation(orientation)); - [[UIApplication sharedApplication] setStatusBarOrientation:uiOrientation animated:NO]; + // Update the QWindow representation straight away, so that + // we can update the statusbar orientation based on the new + // content orientation. + qt_window_private(window())->contentOrientation = orientation; + + [m_view.qtViewController updateProperties]; } void QIOSWindow::applicationStateChanged(Qt::ApplicationState) |