diff options
author | Samuel Nevala <samuel.nevala@digia.com> | 2014-10-22 15:03:51 +0300 |
---|---|---|
committer | Samuel Nevala <samuel.nevala@digia.com> | 2014-10-24 10:20:06 +0200 |
commit | fe919589699790c93b29794f7d116122dd79fbca (patch) | |
tree | 3137864a1c6c3af60406476ea53ee32e72e46983 /src | |
parent | 01cdb04ad579f9105694556062d83d61253aa23f (diff) |
Android: Keyboard doesn't hide from done button
QLineEdit closes input method on enter key press, TextInput
should also do the same. Commit and hide input method on enter
key. When Qt::ImhMultiLine input method hint set only commit.
Task-number: QTBUG-37850
Change-Id: I5a06e3eb777d7f794dd1493b307f0b05a2caf281
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 27752d53b4..1f03fb21e2 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1292,6 +1292,7 @@ void QQuickTextInput::setEchoMode(QQuickTextInput::EchoMode echo) \li Qt.ImhDate - The text editor functions as a date field. \li Qt.ImhTime - The text editor functions as a time field. + \li Qt.ImhMultiLine - The text editor doesn't close software input keyboard when Return or Enter key is pressed (since QtQuick 2.4). \endlist Flags that restrict input (exclusive flags) are: @@ -4192,6 +4193,12 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event) if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { if (hasAcceptableInput(m_text) == AcceptableInput || fixup()) { + + QInputMethod *inputMethod = QGuiApplication::inputMethod(); + inputMethod->commit(); + if (!(q->inputMethodHints() & Qt::ImhMultiLine)) + inputMethod->hide(); + emit q->accepted(); emit q->editingFinished(); } |