summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-02-04 13:33:56 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-02-04 14:33:12 +0100
commitbe06164201d7d9ccdbaaff343af2e8f3662c044d (patch)
tree8383a6e6b9dd5b64fa5d5ae64afd93034bb6c5cb /src/plugins/platforms/ios
parentf4887aca1e5ac7b90abf862d7c9828417a74a1b6 (diff)
iOS: don't report selection changed if it didn't change
Be more careful about reporting a new selection to Qt. The code for handling IM selection events in QQuickTextArea is quite complex and need to take pre-edit text into account. The latter means that when the pre-edit text changes, as a result of the user composing a word, the width of the pre-edit text will also change (and as such, the cursor rectangle). But the cursor position itself stays the same. And for this reason, it emits cursorRectChanged more often than strictly needed. But rather than trying to clean that up, we do some extra checking before we send the IM event from QPA in the first place. Pick-to: 6.0 6.1 5.15 Fixes: QTBUG-63018 Change-Id: I689d989c3fe5d61ef2b1dbee7a70418b7790bce9 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r--src/plugins/platforms/ios/qiostextinputoverlay.mm6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm
index 5776c364c4..23359ec069 100644
--- a/src/plugins/platforms/ios/qiostextinputoverlay.mm
+++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm
@@ -640,8 +640,12 @@ static void executeBlockWithoutAnimation(Block block)
- (void)updateFocalPoint:(QPointF)touchPoint
{
- QPlatformInputContext::setSelectionOnFocusObject(touchPoint, touchPoint);
self.focalPoint = touchPoint;
+
+ const int currentCursorPos = QInputMethod::queryFocusObject(Qt::ImCursorPosition, QVariant()).toInt();
+ const int newCursorPos = QPlatformInputContext::queryFocusObject(Qt::ImCursorPosition, touchPoint).toInt();
+ if (newCursorPos != currentCursorPos)
+ QPlatformInputContext::setSelectionOnFocusObject(touchPoint, touchPoint);
}
@end