From 31a76b978b3f1c08787e3f88987e3a396d5eec45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 10 Dec 2012 19:27:30 +0100 Subject: 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 --- src/plugins/platforms/ios/qiosviewcontroller.mm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') 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 +#include + @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(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; } -- cgit v1.2.3