summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosglobal.mm
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2012-12-18 09:50:28 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 23:55:57 +0100
commit31796ca8abb8878165c7099145b08abfdf8bf1e3 (patch)
tree9a48bbe00ee83432fdb2b8d3bba9f5ddaa0dfb61 /src/plugins/platforms/ios/qiosglobal.mm
parentb960424195634c00673d499e4719ccb4f8704ad0 (diff)
iOS: report changes to keyboard rect back to Qt
QInputContext expects us to report whenever the input panel changes geometry. This patch implements this. Change-Id: I9162f0d48da6925274a7489c9bcb6adab9afae82 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiosglobal.mm')
-rw-r--r--src/plugins/platforms/ios/qiosglobal.mm9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm
index a8a89a1637..f9b4b14a19 100644
--- a/src/plugins/platforms/ios/qiosglobal.mm
+++ b/src/plugins/platforms/ios/qiosglobal.mm
@@ -113,5 +113,14 @@ UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation)
return uiOrientation;
}
+QRect fromPortraitToPrimary(const QRect &rect)
+{
+ // UIScreen is always in portrait. Use this function to convert CGRects
+ // aligned with UIScreen into whatever is the current orientation of QScreen.
+ QScreen *screen = QGuiApplication::primaryScreen();
+ return screen->isPortrait(screen->primaryOrientation()) ? rect
+ : QRect(rect.y(), screen->geometry().width() - rect.width() - rect.x(), rect.height(), rect.width());
+}
+
QT_END_NAMESPACE