Android: Keyboard doesn't hide from done button
QLineEdit commits and hides QInputMethod on enter key press. When Qt::ImhMultiLine input method hint is set, virtual keyboard is not hidden. Task-number: QTBUG-37850 Change-Id: I018351caa18bd2116665771e5f024a57182a01b9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
parent
27a321e1ed
commit
3f9dbc0ec8
@ -1607,6 +1607,13 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
|
|||||||
|
|
||||||
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
|
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
|
||||||
if (hasAcceptableInput() || fixup()) {
|
if (hasAcceptableInput() || fixup()) {
|
||||||
|
|
||||||
|
QInputMethod *inputMethod = QApplication::inputMethod();
|
||||||
|
inputMethod->commit();
|
||||||
|
QWidget *lineEdit = qobject_cast<QWidget *>(parent());
|
||||||
|
if (!(lineEdit && lineEdit->inputMethodHints() & Qt::ImhMultiLine))
|
||||||
|
inputMethod->hide();
|
||||||
|
|
||||||
emit accepted();
|
emit accepted();
|
||||||
emit editingFinished();
|
emit editingFinished();
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,8 @@ public:
|
|||||||
virtual void reset() { m_resetCallCount++; }
|
virtual void reset() { m_resetCallCount++; }
|
||||||
virtual void commit() {
|
virtual void commit() {
|
||||||
m_commitCallCount++;
|
m_commitCallCount++;
|
||||||
|
if (m_commitString.isEmpty())
|
||||||
|
return;
|
||||||
QInputMethodEvent commitEvent;
|
QInputMethodEvent commitEvent;
|
||||||
commitEvent.setCommitString(m_commitString);
|
commitEvent.setCommitString(m_commitString);
|
||||||
if (qGuiApp->focusObject())
|
if (qGuiApp->focusObject())
|
||||||
|
Loading…
Reference in New Issue
Block a user