diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-02-26 13:49:03 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-02-27 23:55:54 +0100 |
commit | d5d3f5ea8e6620e1ae06488a9e35a36550367726 (patch) | |
tree | 033b06155761631d19dd5947defaaec8811a626e /src/plugins/platforms/ios/qiosviewcontroller.mm | |
parent | 70b21ec3c12c655354676778e087182f20aadbb1 (diff) |
iOS: let QIOSScreen change geometry according to interface rotation
Qt expects the screen to change geometry when the "desktop" rotates.
On iOS, we interpret this as when the root view controller changes
orientation, since after all, this is the surface we place QWindows
on top of.
Change-Id: Ia00e68c8f9f0a65aefcc60518ee544fb260d4595
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiosviewcontroller.mm')
-rw-r--r-- | src/plugins/platforms/ios/qiosviewcontroller.mm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 3121597dba..fe9e02666f 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -43,6 +43,7 @@ #include <QtGui/QGuiApplication> #include <QtGui/QScreen> +#include "qiosscreen.h" @implementation QIOSViewController @@ -65,5 +66,16 @@ return UIInterfaceOrientationMaskAll; } +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation +{ + Q_UNUSED(fromInterfaceOrientation); + Qt::ScreenOrientation orientation = convertToQtOrientation(self.interfaceOrientation); + if (orientation == -1) + return; + + QIOSScreen *qiosScreen = static_cast<QIOSScreen *>(QGuiApplication::primaryScreen()->handle()); + qiosScreen->setPrimaryOrientation(orientation); +} + @end |