diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2020-02-13 08:51:05 +0200 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2020-02-19 09:13:45 +0200 |
commit | 39a3c50f6f3d3aff52853510543388638a2524d5 (patch) | |
tree | 9c73634af88d059b65491a4c063ad0ada9d3f2e9 | |
parent | 199491507491df678282185bed633c6942b70182 (diff) |
Fix the long press function on the symbol mode key v3v5.15.0-beta1
- Symbol mode key has a function which allows to select a symbol
from symbol page by long press of the key and moving the finger
to a key on the symbol page. However, if the finger was not moved
away from the symbol key, it simulated a click on the symbol key,
causing it to switch back to main layout. The simulated click is
is needed for the function keys to allow switching between multiple
pages (e.g. the 1/2 key) of symbols without lifting the finger.
- Fix this bug by not simulating the click on the symbols key.
- v2: Fix null pointer reference (QML)
- v3: Do not switch to main layout in case of long press and release
of the symbol mode key. Also, do not activate drag symbol mode if
already in symbol mode.
Task-number: QTBUG-77753
Change-Id: I4543f6ddf532d5b25c237aaeb188404eb9a7bd56
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | src/virtualkeyboard/content/components/Keyboard.qml | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/virtualkeyboard/content/components/Keyboard.qml b/src/virtualkeyboard/content/components/Keyboard.qml index 347f1076..954c6f2f 100644 --- a/src/virtualkeyboard/content/components/Keyboard.qml +++ b/src/virtualkeyboard/content/components/Keyboard.qml @@ -493,7 +493,7 @@ Item { InputContext.inputEngine.virtualKeyCancel() keyboardInputArea.initialKey = null alternativeKeys.openedByNavigationKeyLongPress = keyboard.navigationModeActive - } else if (keyboard.activeKey.key === Qt.Key_Context1) { + } else if (keyboard.activeKey.key === Qt.Key_Context1 && !keyboard.symbolMode) { InputContext.inputEngine.virtualKeyCancel() keyboardInputArea.dragSymbolMode = true keyboard.symbolMode = true @@ -1078,14 +1078,28 @@ Item { InputContext.inputEngine.virtualKeyCancel() setActiveKey(key) press(key, false) - if (dragSymbolMode) - pressAndHoldTimer.restart() + if (dragSymbolMode) { + if (key && key.functionKey && key.key !== Qt.Key_Context1) + pressAndHoldTimer.restart() + else + pressAndHoldTimer.stop() + } } } } onReleased: { - if (containsPoint(touchPoints, activeTouchPoint)) + if (containsPoint(touchPoints, activeTouchPoint)) { + if (dragSymbolMode) { + var key = keyOnPoint(activeTouchPoint.x, activeTouchPoint.y) + if (key && key.key === Qt.Key_Context1) { + dragSymbolMode = false + InputContext.inputEngine.virtualKeyCancel() + reset() + return + } + } releaseActiveKey(); + } } onCanceled: { if (containsPoint(touchPoints, activeTouchPoint)) |