From 0fc578829115d593c9a09bd4b2a5e9fea1a759d1 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 21 Nov 2014 16:08:29 +0100 Subject: Fix for HTC Pinyin input method HTC does not do beginBatchEdit/endBatchEdit when committing text. We implement the commit in two steps: first set the text, then move the cursor. To avoid sending an updateSelection for the intermediate state, we need to block updates when we set the text in the editor. Task-number: QTBUG-42300 Change-Id: Icd18700ecf1fba5acb9f8a78762555c1309b221b Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidinputcontext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index a3848c9c2b..7e81735de9 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -611,6 +611,9 @@ jboolean QAndroidInputContext::endBatchEdit() */ jboolean QAndroidInputContext::commitText(const QString &text, jint newCursorPosition) { + bool updateSelectionWasBlocked = m_blockUpdateSelection; + m_blockUpdateSelection = true; + QInputMethodEvent event; event.setCommitString(text); sendInputMethodEventThreadSafe(&event); @@ -630,6 +633,7 @@ jboolean QAndroidInputContext::commitText(const QString &text, jint newCursorPos newLocalPos, 0, QVariant())); } } + m_blockUpdateSelection = updateSelectionWasBlocked; updateCursorPosition(); return JNI_TRUE; -- cgit v1.2.3