diff options
author | Andy Shaw <andy.shaw@qt.io> | 2018-02-21 15:14:51 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2018-03-09 11:02:21 +0000 |
commit | 7683c588600fb23f774cbdbb4aacb4dd44d073e8 (patch) | |
tree | 66ad53e5557ff75ea5b7520f1b38158aa9461d42 | |
parent | c1bc35736503e5ceaee1991745eb5a43a013be40 (diff) |
FullScreenMode: Send return key without modifiersv5.11.0-beta2
When the return key is sent to a multiple line text field it can be
interpreted differently if the Shift modifier is included. This makes
sense for a hard keyboard as you can use it to enter in a new line
versus a new paragraph. For the virtual keyboard however, it is best to
just send it as a plain return so it handles it correctly.
Change-Id: I995504d7ab6961fd8baf016d2d68be4b659d1e19
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | src/virtualkeyboard/defaultinputmethod.cpp | 3 | ||||
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/virtualkeyboard/defaultinputmethod.cpp b/src/virtualkeyboard/defaultinputmethod.cpp index cf511e9a..4d1aa280 100644 --- a/src/virtualkeyboard/defaultinputmethod.cpp +++ b/src/virtualkeyboard/defaultinputmethod.cpp @@ -63,7 +63,8 @@ bool DefaultInputMethod::setTextCase(InputEngine::TextCase textCase) bool DefaultInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) { - inputContext()->sendKeyClick(key, text, modifiers); + const Qt::KeyboardModifiers mods = (key == Qt::Key_Return) ? Qt::NoModifier : modifiers; + inputContext()->sendKeyClick(key, text, mods); return true; } diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml index 0b9f11ff..05c88d82 100644 --- a/tests/auto/inputpanel/data/tst_inputpanel.qml +++ b/tests/auto/inputpanel/data/tst_inputpanel.qml @@ -1858,5 +1858,18 @@ Rectangle { } } + function test_fullScreenModeReturnKey() { + prepareTest() + + textInput.text = "" + textInput.inputMethodHints = Qt.ImhUppercaseOnly + inputPanel.setFullScreenMode(true) + waitForRendering(inputPanel) + inputPanel.shadowInputControlVisibleSpy.wait() + verify(inputPanel.virtualKeyClick(Qt.Key_A)) + verify(inputPanel.virtualKeyClick(Qt.Key_Return)) + compare(inputPanel.shadowInput.text, "") + } + } } |