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>
This commit is contained in:
parent
2196518709
commit
31a76b978b
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user