From 2e365245c185aa1fb5c130024f30c0a35d927239 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 2 Oct 2014 09:50:10 +0200 Subject: 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 --- src/plugins/platforms/android/qandroidinputcontext.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index abda72e636..a23d05520c 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -441,10 +441,14 @@ void QAndroidInputContext::reset() { clear(); m_batchEditNestingLevel = 0; - if (qGuiApp->focusObject()) - QtAndroidInput::resetSoftwareKeyboard(); - else - QtAndroidInput::hideSoftwareKeyboard(); + if (qGuiApp->focusObject()) { + QSharedPointer query = focusObjectInputMethodQueryThreadSafe(Qt::ImEnabled); + if (!query.isNull() && query->value(Qt::ImEnabled).toBool()) { + QtAndroidInput::resetSoftwareKeyboard(); + return; + } + } + QtAndroidInput::hideSoftwareKeyboard(); } void QAndroidInputContext::commit() -- cgit v1.2.3