From 2dea9fdc3a04ccc9759427c6450e88cb78003381 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 19 Dec 2012 09:15:27 +0100 Subject: iOS: add convenience function to get to the root QIOSViewController MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that we need to access our view controller from many places, and the syntax to do so is tricky to remember. So lets just add it to our global functions, with the added bonus of a using a little cache. Note: many of these functions could be made inline, but since one concern of the plugin will be the end size of the app, I prefer to trade size for speed at this point. We can always change this later. Change-Id: I578ea9ae8218d23d635b7728a930763ca53c4eaa Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosscreen.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/ios/qiosscreen.mm') diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index a0403a0d69..5905f1630e 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -44,6 +44,7 @@ #include "qioswindow.h" #include #include "qiosapplicationdelegate.h" +#include "qiosviewcontroller.h" #include @@ -141,8 +142,7 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) if (isQtApplication()) { // When in a non-mixed environment, let QScreen follow the current interface orientation: - UIViewController *controller = [UIApplication sharedApplication].delegate.window.rootViewController; - setPrimaryOrientation(toQtScreenOrientation(controller.interfaceOrientation)); + setPrimaryOrientation(toQtScreenOrientation(rootViewController().interfaceOrientation)); } [pool release]; -- cgit v1.2.3