From 8885344ad48abe9a707868ce5677f32b05338a50 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 11 Dec 2015 15:13:11 +0100 Subject: iOS: Don't hide keyboard on "Done" button when focus object has changed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the focus object changed programmatically for example to the next input field in a window, we want to keep the keyboard open. This strangely only worked if the inputs had different IM hints because this made the keyboard appear again. Change-Id: I52e66bb7d2ff97ae7084173769d9b5c2d0c549b5 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostextresponder.mm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 2e8c0cb4db..e6ea43652f 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -925,6 +925,14 @@ if ([text isEqualToString:@"\n"]) { [self sendKeyPressRelease:Qt::Key_Return modifiers:Qt::NoModifier]; + // An onEnter handler of a TextInput might move to the next input by calling + // nextInput.forceActiveFocus() which changes the focusObject. + // In that case we don't want to hide the VKB. + if (focusObject != QGuiApplication::focusObject()) { + qImDebug() << "focusObject already changed, not resigning first responder."; + return; + } + if (self.returnKeyType == UIReturnKeyDone || self.returnKeyType == UIReturnKeyGo || self.returnKeyType == UIReturnKeySend || self.returnKeyType == UIReturnKeySearch) [self resignFirstResponder]; -- cgit v1.2.3