From d665ba2a9454dbd2ed9f4384e04c31d232b0c5eb Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 17 Dec 2012 13:39:59 +0100 Subject: [PATCH] iOS: let QIOSScreen use correct orientation at startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When QScreen is created, we need to check if the application is already in landscape. Change-Id: I653c622154a5c23ec93e89ec3e80fefb6b1f1bdd Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosscreen.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 02d719eaf1..a2fd10bdd4 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -42,6 +42,7 @@ #include "qiosscreen.h" #include "qioswindow.h" #include +#include "qiosapplicationdelegate.h" #include @@ -185,6 +186,12 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) const qreal millimetersPerInch = 25.4; m_physicalSize = QSizeF(m_geometry.size()) / unscaledDpi * millimetersPerInch; + if ([[UIApplication sharedApplication].delegate isKindOfClass:[QIOSApplicationDelegate class]]) { + // When in a non-mixed environment, let QScreen follow the current interface orientation: + UIViewController *controller = [UIApplication sharedApplication].delegate.window.rootViewController; + setPrimaryOrientation(toQtScreenOrientation(controller.interfaceOrientation)); + } + [pool release]; }