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:
parent
132348a864
commit
127f19c7e3
@ -142,7 +142,7 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex)
|
||||
|
||||
if (isQtApplication()) {
|
||||
// When in a non-mixed environment, let QScreen follow the current interface orientation:
|
||||
setPrimaryOrientation(toQtScreenOrientation(rootViewController().interfaceOrientation));
|
||||
setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation(rootViewController().interfaceOrientation)));
|
||||
}
|
||||
|
||||
[pool release];
|
||||
|
@ -78,7 +78,7 @@
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
Qt::ScreenOrientation orientation = toQtScreenOrientation(toInterfaceOrientation);
|
||||
Qt::ScreenOrientation orientation = toQtScreenOrientation(UIDeviceOrientation(toInterfaceOrientation));
|
||||
if (orientation == -1)
|
||||
return;
|
||||
|
||||
|
@ -501,7 +501,7 @@ void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientatio
|
||||
{
|
||||
// Keep the status bar in sync with content orientation. This will ensure
|
||||
// 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];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user