diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2021-06-17 14:07:38 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-17 15:27:42 +0000 |
commit | e847e5bc765256521970f7f85e90bda66bd6f98e (patch) | |
tree | 936e74494a313e44478e4ba87dde6cbc6fb82fea | |
parent | 0d2174eb62852d173113d2fa5468775404744b81 (diff) |
plugins/openwnn: Set word candidate index when item is selected
When an item is selected from the word candidate list, the
activeWordIndex variable was not updated to match the selected index,
resulting in a missed list update.
Fixes: QTBUG-94560
Change-Id: I5757081a1269439fe39d5b5e93dd6f43382cce15
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit c502a07d2db51063feaf7210ba5b09d61ff5b027)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/plugins/openwnn/plugin/openwnninputmethod.cpp | 1 | ||||
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/openwnn/plugin/openwnninputmethod.cpp b/src/plugins/openwnn/plugin/openwnninputmethod.cpp index 8df4841b..52405dca 100644 --- a/src/plugins/openwnn/plugin/openwnninputmethod.cpp +++ b/src/plugins/openwnn/plugin/openwnninputmethod.cpp @@ -805,6 +805,7 @@ void OpenWnnInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionList { Q_UNUSED(type) Q_D(OpenWnnInputMethod); + d->activeWordIndex = index; // Set selected text as preeditText to place cursor at the end of selected text inputContext()->setPreeditText(d->candidateList.at(index)->candidate); d->commitText(*d->candidateList.at(index)); diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml index f4168d25..29c739a9 100644 --- a/tests/auto/inputpanel/data/tst_inputpanel.qml +++ b/tests/auto/inputpanel/data/tst_inputpanel.qml @@ -1235,6 +1235,19 @@ Rectangle { compare(textInput.cursorPosition, data.expectedCursorPosition) } + function test_japaneseSelectCurrentItemResetsIndex() { + prepareTest({ initLocale: "ja_JP" }, true) + + verify(inputPanel.virtualKeyClick("a")) + verify(inputPanel.virtualKeyClick("a")) + verify(inputPanel.virtualKeyClick("a")) + + compare(inputPanel.wordCandidateView.currentIndex, -1) + inputPanel.wordCandidateView.currentIndex = 0 + inputPanel.selectionListSelectCurrentItem() + compare(inputPanel.wordCandidateView.currentIndex, -1, "QTBUG-94560") + } + function test_baseKeyNoModifier() { // The Japanese keyboard uses the BaseKey.noModifier flag for the arrow keys. // Without this flag the arrow key + shift would extend the text selection. |