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 <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
Paul Olav Tvete 2014-11-21 16:08:29 +01:00 committed by Jani Heikkinen
parent d958a16bc1
commit 0fc5788291

View File

@ -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;