aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2018-08-22 23:25:59 +0300
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2018-08-30 07:03:51 +0000
commit7f12d8bb06e7cdc932cfcc7a8d1eaf12b74e8eff (patch)
tree981632136944d0c7315d4db806c980c15a43c26d
parent7d764eecbf69969661003c9f7874fde1e99fcc2a (diff)
Fix regression in arrow key navigation
When word candidate view contained items and an alternative keys view was opened by long press key, the word candidate item was selected together with alternative key. This regression was introduced in commit e803aec1ea21fd00e13b9535a4b536cc43c26ee4 Change-Id: Ie6f7e1580ddcc5327104eafafc3a10c86e9abb65 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
-rw-r--r--src/virtualkeyboard/content/components/Keyboard.qml21
-rw-r--r--tests/auto/inputpanel/data/tst_inputpanel.qml11
2 files changed, 25 insertions, 7 deletions
diff --git a/src/virtualkeyboard/content/components/Keyboard.qml b/src/virtualkeyboard/content/components/Keyboard.qml
index bd885f73..47566e55 100644
--- a/src/virtualkeyboard/content/components/Keyboard.qml
+++ b/src/virtualkeyboard/content/components/Keyboard.qml
@@ -360,12 +360,6 @@ Item {
keyboardInputArea.reset()
keyboardInputArea.navigateToNextKey(0, 0, false)
}
- } else if (alternativeKeys.active) {
- if (!isAutoRepeat) {
- alternativeKeys.clicked()
- keyboardInputArea.reset()
- keyboardInputArea.navigateToNextKey(0, 0, false)
- }
} else if (keyboardInputArea.initialKey) {
if (!isAutoRepeat) {
pressAndHoldTimer.restart()
@@ -406,6 +400,15 @@ Item {
} else {
wordCandidateContextMenu.openedByNavigationKeyLongPress = false
}
+ } else if (alternativeKeys.active) {
+ if (!alternativeKeys.openedByNavigationKeyLongPress) {
+ alternativeKeys.clicked()
+ alternativeKeys.close()
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ keyboardInputArea.reset()
+ } else {
+ alternativeKeys.openedByNavigationKeyLongPress = false
+ }
} else if (!wordCandidateContextMenu.active && wordCandidateView.count > 0) {
wordCandidateView.model.selectItem(wordCandidateView.currentIndex)
if (!InputContext.preeditText.length)
@@ -454,9 +457,12 @@ Item {
keyboard.y + alternativeKeys.listView.y - verticalMargin,
alternativeKeys.listView.width + horizontalMargin * 2,
alternativeKeys.listView.height + verticalMargin * 2)
+ property bool openedByNavigationKeyLongPress
onVisibleChanged: {
if (visible)
InputContext.priv.previewRectangle = Qt.binding(function() {return previewRect})
+ else
+ openedByNavigationKeyLongPress = false
InputContext.priv.previewVisible = visible
}
}
@@ -469,6 +475,7 @@ Item {
if (alternativeKeys.open(keyboard.activeKey, origin.x, origin.y)) {
InputContext.inputEngine.virtualKeyCancel()
keyboardInputArea.initialKey = null
+ alternativeKeys.openedByNavigationKeyLongPress = keyboard.navigationModeActive
} else if (keyboard.activeKey.key === Qt.Key_Context1) {
InputContext.inputEngine.virtualKeyCancel()
keyboardInputArea.dragSymbolMode = true
@@ -488,7 +495,7 @@ Item {
keyboardInputArea.navigateToNextKey(0, 0, false)
} else if (!wordCandidateContextMenu.active) {
wordCandidateContextMenu.show(wordCandidateView.currentIndex)
- wordCandidateContextMenu.openedByNavigationKeyLongPress = true
+ wordCandidateContextMenu.openedByNavigationKeyLongPress = keyboard.navigationModeActive
}
}
}
diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml
index 67009c9a..faaf44ce 100644
--- a/tests/auto/inputpanel/data/tst_inputpanel.qml
+++ b/tests/auto/inputpanel/data/tst_inputpanel.qml
@@ -697,6 +697,17 @@ Rectangle {
verify(inputPanel.keyboardInputArea.initialKey === focusKey)
verify(inputPanel.wordCandidateView.currentIndex !== -1)
+ // Select alternative key and check word candidates
+ verify(inputPanel.navigationKeyClick("e"))
+ var focusKeyAlt = inputPanel.keyboardInputArea.initialKey
+ verify(inputPanel.navigationKeyClick("ë"))
+ verify(inputPanel.wordCandidateView.count > 1)
+ verify(inputPanel.keyboardInputArea.initialKey === focusKeyAlt)
+ verify(inputPanel.navigationKeyClick(Qt.Key_Backspace))
+ verify(inputPanel.navigationKeyClick(Qt.Key_Backspace))
+ verify(inputPanel.navigationKeyClick(Qt.Key_Backspace))
+ verify(inputPanel.navigationKeyClick("q"))
+
// Move focus to word candidate list
inputPanel.emulateNavigationKeyClick(Qt.Key_Up)
verify(inputPanel.keyboardInputArea.initialKey === null)