iOS: Update QIOSScreen::nativeOrientation() for iOS8

For iOS8 and up [UIScreen bounds] changes based on the interface orientation,
so we need to use [UIScreen nativeBounds] instead.

Change-Id: I3fc12cfa417df26ca94c803e970bc2dc18a94378
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ø 2014-07-28 14:46:18 +02:00
parent 0c9ae66082
commit f6c36917f1

View File

@ -294,8 +294,15 @@ qreal QIOSScreen::devicePixelRatio() const
Qt::ScreenOrientation QIOSScreen::nativeOrientation() const
{
// A UIScreen stays in the native orientation, regardless of rotation
return m_uiScreen.bounds.size.width >= m_uiScreen.bounds.size.height ?
CGRect nativeBounds =
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0)
QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 ? m_uiScreen.nativeBounds :
#endif
m_uiScreen.bounds;
// All known iOS devices have a native orientation of portrait, but to
// be on the safe side we compare the width and height of the bounds.
return nativeBounds.size.width >= nativeBounds.size.height ?
Qt::LandscapeOrientation : Qt::PortraitOrientation;
}