diff options
-rw-r--r-- | src/plugins/platforms/ios/qiosinputcontext.mm | 3 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiostextresponder.mm | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 69bdf4aa87..e8b16a0ed8 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -514,7 +514,8 @@ void QIOSInputContext::setFocusObject(QObject *focusObject) qImDebug() << "new focus object =" << focusObject; - if (m_keyboardHideGesture.state == UIGestureRecognizerStateChanged) { + if (QPlatformInputContext::inputMethodAccepted() + && m_keyboardHideGesture.state == UIGestureRecognizerStateChanged) { // A new focus object may be set as part of delivering touch events to // application during the hide-keyboard gesture, but we don't want that // to result in a new object getting focus and bringing the keyboard up diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 2fcc7258f7..bebc7577f8 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -263,10 +263,14 @@ // will set the new first-responder to our next-responder, and in the latter // case we'll have an active responder candidate. if ([UIResponder currentFirstResponder] == [self nextResponder]) { - // We have resigned the keyboard, and transferred back to the parent view, so unset focus object + // We have resigned the keyboard, and transferred first responder back to the parent view Q_ASSERT(!FirstResponderCandidate::currentCandidate()); - qImDebug() << "keyboard was closed, clearing focus object"; - m_inputContext->clearCurrentFocusObject(); + if ([self imValue:Qt::ImEnabled].toBool()) { + // The current focus object expects text input, but there + // is no keyboard to get input from. So we clear focus. + qImDebug() << "no keyboard available, clearing focus object"; + m_inputContext->clearCurrentFocusObject(); + } } else { // We've lost responder status because another Qt window was made active, // another QIOSTextResponder was made first-responder, another UIView was |