iOS: Handle UIDeviceOrientation vs UIInterfaceOrientation

The former represents the physical device orientation, the latter the
UI orientation. We need to explicitly cast between them, as they are
different enums, but with compatible values for the subset we use.

Change-Id: I2926068802f35680cb6de5ced6dcf286014fdb2e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
Tor Arne Vestbø 2013-04-03 16:58:59 +02:00 committed by The Qt Project
parent 132348a864
commit 127f19c7e3
3 changed files with 3 additions and 3 deletions

View File

@ -142,7 +142,7 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex)
if (isQtApplication()) { if (isQtApplication()) {
// When in a non-mixed environment, let QScreen follow the current interface orientation: // When in a non-mixed environment, let QScreen follow the current interface orientation:
setPrimaryOrientation(toQtScreenOrientation(rootViewController().interfaceOrientation)); setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation(rootViewController().interfaceOrientation)));
} }
[pool release]; [pool release];

View File

@ -78,7 +78,7 @@
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{ {
Q_UNUSED(duration); Q_UNUSED(duration);
Qt::ScreenOrientation orientation = toQtScreenOrientation(toInterfaceOrientation); Qt::ScreenOrientation orientation = toQtScreenOrientation(UIDeviceOrientation(toInterfaceOrientation));
if (orientation == -1) if (orientation == -1)
return; return;

View File

@ -501,7 +501,7 @@ void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientatio
{ {
// Keep the status bar in sync with content orientation. This will ensure // Keep the status bar in sync with content orientation. This will ensure
// that the task bar (and associated gestures) are aligned correctly: // that the task bar (and associated gestures) are aligned correctly:
UIDeviceOrientation uiOrientation = fromQtScreenOrientation(orientation); UIInterfaceOrientation uiOrientation = UIInterfaceOrientation(fromQtScreenOrientation(orientation));
[[UIApplication sharedApplication] setStatusBarOrientation:uiOrientation animated:NO]; [[UIApplication sharedApplication] setStatusBarOrientation:uiOrientation animated:NO];
} }