diff options
Diffstat (limited to 'src/plugins/platforms/ios/qiosscreen.mm')
-rw-r--r-- | src/plugins/platforms/ios/qiosscreen.mm | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index d53f0df846..b9c77e9bba 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -143,21 +143,25 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen) self = [super init]; if (self) { m_screen = screen; +#ifndef Q_OS_TVOS [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; +#endif } return self; } - (void)dealloc { +#ifndef Q_OS_TVOS [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] removeObserver:self name:@"UIDeviceOrientationDidChangeNotification" object:nil]; +#endif [super dealloc]; } @@ -256,9 +260,14 @@ void QIOSScreen::updateProperties() QRect previousGeometry = m_geometry; QRect previousAvailableGeometry = m_availableGeometry; - m_geometry = fromCGRect(m_uiScreen.bounds).toRect(); - m_availableGeometry = fromCGRect(m_uiScreen.applicationFrame).toRect(); + m_geometry = QRectF::fromCGRect(m_uiScreen.bounds).toRect(); +#ifdef Q_OS_TVOS + m_availableGeometry = m_geometry; +#else + m_availableGeometry = QRectF::fromCGRect(m_uiScreen.applicationFrame).toRect(); +#endif +#ifndef Q_OS_TVOS if (m_uiScreen == [UIScreen mainScreen]) { Qt::ScreenOrientation statusBarOrientation = toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation)); @@ -286,6 +295,7 @@ void QIOSScreen::updateProperties() m_availableGeometry = transform.mapRect(m_availableGeometry); } } +#endif if (m_geometry != previousGeometry) { QRectF physicalGeometry; @@ -298,7 +308,7 @@ void QIOSScreen::updateProperties() // before being output on the physical display. We have to take this into account when // computing the physical size. Note that unlike the native bounds, the physical size // follows the primary orientation of the screen. - physicalGeometry = mapBetween(nativeOrientation(), primaryOrientation, fromCGRect(m_uiScreen.nativeBounds).toRect()); + physicalGeometry = mapBetween(nativeOrientation(), primaryOrientation, QRectF::fromCGRect(m_uiScreen.nativeBounds).toRect()); } else { physicalGeometry = QRectF(0, 0, m_geometry.width() * devicePixelRatio(), m_geometry.height() * devicePixelRatio()); } @@ -393,7 +403,7 @@ qreal QIOSScreen::devicePixelRatio() const Qt::ScreenOrientation QIOSScreen::nativeOrientation() const { CGRect nativeBounds = -#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0) +#if !defined(Q_OS_TVOS) && QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0) QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 ? m_uiScreen.nativeBounds : #endif m_uiScreen.bounds; @@ -406,6 +416,9 @@ Qt::ScreenOrientation QIOSScreen::nativeOrientation() const Qt::ScreenOrientation QIOSScreen::orientation() const { +#ifdef Q_OS_TVOS + return Qt::PrimaryOrientation; +#else // Auxiliary screens are always the same orientation as their primary orientation if (m_uiScreen != [UIScreen mainScreen]) return Qt::PrimaryOrientation; @@ -430,6 +443,7 @@ Qt::ScreenOrientation QIOSScreen::orientation() const } return toQtScreenOrientation(deviceOrientation); +#endif } void QIOSScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) |