Android: Hide vkb when IM disabled for focus object

When the focus object changes to an object that does not have
IM enabled, we should hide the keyboard instead of resetting it.
This happens, for instance, if you change to a different tab in
an application while a text input in the previous tab had focus.
Previously the input panel would stay open and overlap part of the
new tab.

[ChangeLog][Android] Hide input panel when focus changes to an
object that does not accept input.

Change-Id: I4009d203559582fa02c15fdc1a3f009396af2531
Task-number: QTBUG-32399
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2014-10-02 09:50:10 +02:00 committed by Eskil Abrahamsen Blomfeldt
parent 27f5efb895
commit 2e365245c1

View File

@ -441,9 +441,13 @@ void QAndroidInputContext::reset()
{
clear();
m_batchEditNestingLevel = 0;
if (qGuiApp->focusObject())
if (qGuiApp->focusObject()) {
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQueryThreadSafe(Qt::ImEnabled);
if (!query.isNull() && query->value(Qt::ImEnabled).toBool()) {
QtAndroidInput::resetSoftwareKeyboard();
else
return;
}
}
QtAndroidInput::hideSoftwareKeyboard();
}