diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2021-08-05 10:21:07 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-23 14:53:22 +0000 |
commit | f43f7096e8b2f6d9a76617a1901ba5019340ec6e (patch) | |
tree | 9aec477cee1062bfbc30c2f04f9737b496763a1d /tests | |
parent | fc5045f1dae1ca1554e657d3d5625d540def8859 (diff) |
qquicktextinput: Clear pre-edit text after input method reset
The QPlatformInputContext::reset() function does not allow any further
input method events to be called. Therefore, clearing the pre-edit text
is the sole responsibility of the text input control.
This change modifies the QQuickTextInputPrivate::resetInputMethod()
function and calls QQuickTextInputPrivate::cancelPreedit() instead of
QInputMethod::reset() directly. The cancelPreedit() function will send
a QInputMethodEvent which clears the IM state (in addition of calling
QInputMethod::reset() function).
Also, rename the QQuickTextInputPrivate::resetInputMethod() function to
cancelInput, since it does not call inputMethod()->reset() directly.
Fixes: QTBUG-95461
Change-Id: I6ab3b9dbe71956af72656e2a25a05d79603b34ea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
(cherry picked from commit b2103e33f490c96d0068d211c6f2d5b540ca407e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index f61be67107..04d0302427 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -5893,6 +5893,7 @@ void tst_qquicktextinput::clear() textInput->clear(); QVERIFY(textInput->text().isEmpty()); + QVERIFY2(textInput->preeditText().isEmpty(), "Pre-edit text must be empty after clear"); QCOMPARE(spy.count(), 3); @@ -5901,6 +5902,7 @@ void tst_qquicktextinput::clear() QVERIFY(!textInput->canUndo()); QCOMPARE(spy.count(), 4); QCOMPARE(textInput->text(), QString("I am Legend")); + QVERIFY2(textInput->preeditText().isEmpty(), "Pre-edit text must be empty after undo"); } void tst_qquicktextinput::backspaceSurrogatePairs() |