diff options
-rw-r--r-- | src/virtualkeyboard/content/components/Keyboard.qml | 21 | ||||
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 11 |
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) |