iOS: add function convertToUIOrientation
Change-Id: I6145121d49eb3f5bab3f2a1ba57c779ec0b01023 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>bb10
parent
92252bcb93
commit
72f66a8ee5
|
|
@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
class QIOSScreen;
|
||||
Qt::ScreenOrientation convertToQtOrientation(UIDeviceOrientation uiDeviceOrientation);
|
||||
UIDeviceOrientation convertToUIOrientation(Qt::ScreenOrientation qtOrientation);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue