summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2012-12-10 19:27:30 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 23:55:51 +0100
commit31a76b978b3f1c08787e3f88987e3a396d5eec45 (patch)
treefd252a426e595a086fc411277ac829fec14d76d2
parent21965187096f8bde7866b05459444793e1a6c1b1 (diff)
iOS: Enable auto-rotation if no orientation update-mask has been set
This is an intermediate heuristic until we have a proper API in Qt to deal with auto-rotation and orientation locking. Change-Id: I433992fa1c18d1670987f79e405a4501b6e5d365 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm
index a807dc2132..3121597dba 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.mm
+++ b/src/plugins/platforms/ios/qiosviewcontroller.mm
@@ -41,18 +41,27 @@
#import "qiosviewcontroller.h"
+#include <QtGui/QGuiApplication>
+#include <QtGui/QScreen>
+
@implementation QIOSViewController
-(BOOL)shouldAutorotate
{
- return NO;
+ // For now we assume that if the application doesn't listen to orientation
+ // updates it means it would like to enable auto-rotation, and vice versa.
+ if (QGuiApplication *guiApp = qobject_cast<QGuiApplication *>(qApp))
+ return !guiApp->primaryScreen()->orientationUpdateMask();
+ else
+ return NO;
+
+ // FIXME: Investigate a proper Qt API for auto-rotation and orientation locking
}
-(NSUInteger)supportedInterfaceOrientations
{
// We need to tell iOS that we support all orientations in order to set
// status bar orientation when application content orientation changes.
- // But we return 'NO' above when asked if we 'shouldAutorotate':
return UIInterfaceOrientationMaskAll;
}