diff options
Diffstat (limited to 'src/plugins/platforms/ios/qioswindow.mm')
-rw-r--r-- | src/plugins/platforms/ios/qioswindow.mm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 13815a22bf..0c3ae8e834 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -150,7 +150,8 @@ - (void)updateTouchList:(NSSet *)touches withState:(Qt::TouchPointState)state { - QRect applicationRect = fromCGRect(self.window.screen.applicationFrame); + QPlatformScreen *screen = QGuiApplication::primaryScreen()->handle(); + QRect applicationRect = fromPortraitToPrimary(fromCGRect(self.window.screen.applicationFrame), screen); foreach (UITouch *uiTouch, m_activeTouches.keys()) { QWindowSystemInterface::TouchPoint &touchPoint = m_activeTouches[uiTouch]; @@ -163,8 +164,10 @@ // Find the touch position relative to the window. Then calculate the screen // position by subtracting the position of the applicationRect (since UIWindow // does not take that into account when reporting its own frame): - QPoint touchPos = fromCGPoint([uiTouch locationInView:nil]); - touchPoint.area = QRectF(touchPos - applicationRect.topLeft(), QSize(0, 0)); + QRect touchInWindow = QRect(fromCGPoint([uiTouch locationInView:nil]), QSize(0, 0)); + QRect touchInScreen = fromPortraitToPrimary(touchInWindow, screen); + QPoint touchPos = touchInScreen.topLeft() - applicationRect.topLeft(); + touchPoint.area = QRectF(touchPos, QSize(0, 0)); touchPoint.normalPosition = QPointF(touchPos.x() / applicationRect.width(), touchPos.y() / applicationRect.height()); } } |