summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Goetz <markus@woboq.com>2015-12-11 15:13:11 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-12-17 13:47:21 +0000
commit8885344ad48abe9a707868ce5677f32b05338a50 (patch)
treeddd5f047d6a9b5d920dddd0b057c37b74df2676d
parentbace82bffe7289d1a10ad652c4510b193d71c922 (diff)
iOS: Don't hide keyboard on "Done" button when focus object has changed
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ø <tor.arne.vestbo@theqtcompany.com>
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm8
1 files changed, 8 insertions, 0 deletions
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];