summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-02-04 13:33:56 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-11 08:22:37 +0000
commitcdf8c961183c856fed58bc201bf0d67e8207d3f5 (patch)
tree13b032c1abd01cb205ffc257b3f70bb8e60549cc /src/plugins/platforms
parent89590a1fedc6787bd6f7578fcbe270f1fce1e2df (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. Fixes: QTBUG-63018 Change-Id: I689d989c3fe5d61ef2b1dbee7a70418b7790bce9 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit be06164201d7d9ccdbaaff343af2e8f3662c044d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins/platforms')
-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 65a296e897..2ab732df7a 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