summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiostextresponder.mm
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2015-07-03 13:46:21 +0200
committerRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2015-08-11 10:13:38 +0000
commitafaeecd4e8adc5de3a94bbdbf7e6d805d66c4241 (patch)
tree026af0a637b770022a35d77fc77cfb947e0113d3 /src/plugins/platforms/ios/qiostextresponder.mm
parent0cf00efcedb8f8ef438f8d204b7adf938849bf9c (diff)
iOS: ensure that we restore text selection with correct cursor and anchor pos
Qt keeps track of the selection direction since a selection anchor can be placed both to the left or to the right of the cursor. On iOS, the selection should instead always be specified from left to right (using a position together with a positive length). So when restoring the selection after performing the calculation of the text rect, we need to ensure that we follow this format. Change-Id: Id8bea6c35e2781e1431ee963f601b6e9ef05dbf5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiostextresponder.mm')
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index e933c43a9e..be9c3b9e27 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -578,7 +578,7 @@
if (cursorPos != int(r.location + r.length) || cursorPos != anchorPos) {
attrs = QList<QInputMethodEvent::Attribute>();
- attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, cursorPos, (cursorPos - anchorPos), 0);
+ attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, qMin(cursorPos, anchorPos), qAbs(cursorPos - anchorPos), 0);
e = QInputMethodEvent(m_markedText, attrs);
[self sendEventToFocusObject:e];
}