iOS: let QIOSScreen use correct orientation at startup

When QScreen is created, we need to check if the application
is already in landscape.

Change-Id: I653c622154a5c23ec93e89ec3e80fefb6b1f1bdd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
bb10
Richard Moe Gustavsen 2012-12-17 13:39:59 +01:00 committed by Tor Arne Vestbø
parent 70774d021a
commit d665ba2a94
1 changed files with 7 additions and 0 deletions

View File

@ -42,6 +42,7 @@
#include "qiosscreen.h"
#include "qioswindow.h"
#include <qpa/qwindowsysteminterface.h>
#include "qiosapplicationdelegate.h"
#include <sys/sysctl.h>
@ -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];
}