iOS: add function convertToUIOrientation

Change-Id: I6145121d49eb3f5bab3f2a1ba57c779ec0b01023
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
bb10
Richard Moe Gustavsen 2012-11-15 14:02:04 +01:00 committed by Tor Arne Vestbø
parent 92252bcb93
commit 72f66a8ee5
2 changed files with 23 additions and 0 deletions

View File

@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
class QIOSScreen;
Qt::ScreenOrientation convertToQtOrientation(UIDeviceOrientation uiDeviceOrientation);
UIDeviceOrientation convertToUIOrientation(Qt::ScreenOrientation qtOrientation);
QT_END_NAMESPACE

View File

@ -69,6 +69,28 @@ Qt::ScreenOrientation convertToQtOrientation(UIDeviceOrientation uiDeviceOrienta
return qtOrientation;
}
UIDeviceOrientation convertToUIOrientation(Qt::ScreenOrientation qtOrientation)
{
UIDeviceOrientation uiOrientation;
switch (qtOrientation) {
case Qt::LandscapeOrientation:
uiOrientation = UIDeviceOrientationLandscapeRight;
break;
case Qt::InvertedLandscapeOrientation:
uiOrientation = UIDeviceOrientationLandscapeLeft;
break;
case Qt::InvertedPortraitOrientation:
uiOrientation = UIDeviceOrientationPortraitUpsideDown;
break;
case Qt::PrimaryOrientation:
case Qt::PortraitOrientation:
default:
uiOrientation = UIDeviceOrientationPortrait;
break;
}
return uiOrientation;
}
QT_END_NAMESPACE
@implementation QIOSOrientationListener