From 3231c458b1a5957d24217cf3e13b6f2fcecd4288 Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Tue, 5 Mar 2024 08:36:56 +0000 Subject: Revert "QAndroidPlatformInputContext: send composition text and cursor jointly" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit be3b9b2ab12f664c196d649e8c4247d70805d667. Reason for revert: Caused QTBUG-121561 Fixes: QTBUG-121561 Pick-to: 6.2 Change-Id: I4b59d97ede6c50d2575a7d7cebbe2291983dd19f Reviewed-by: Tor Arne Vestbø (cherry picked from commit 46502f9705634f02626ee1057975463d1c0ae1f8) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit c76dd919fd89a9cf4fcbbf162423d12f3b5d6090) (cherry picked from commit cf6f0191be77b17e9e8f78e87b12ba99fbd0006e) --- .../platforms/android/qandroidinputcontext.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/plugins/platforms/android/qandroidinputcontext.cpp') diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 41f6ba13143..1ea326c7183 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -1156,13 +1156,21 @@ bool QAndroidInputContext::focusObjectStopComposing() m_composingCursor = -1; - // commit composing text and cursor position - QList attributes; - attributes.append( - QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, 0)); - QInputMethodEvent event(QString(), attributes); - event.setCommitString(m_composingText); - sendInputMethodEvent(&event); + { + // commit the composing test + QList attributes; + QInputMethodEvent event(QString(), attributes); + event.setCommitString(m_composingText); + sendInputMethodEvent(&event); + } + { + // Moving Qt's cursor to where the preedit cursor used to be + QList attributes; + attributes.append( + QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, 0)); + QInputMethodEvent event(QString(), attributes); + sendInputMethodEvent(&event); + } return true; } -- cgit v1.2.3