path: root/src
diff options
authorRichard Moe Gustavsen <>2014-05-23 10:51:19 +0200
committerThe Qt Project <>2014-05-23 14:46:19 +0200
commit28f32afd3fed07c7772b76faf731bb104810d934 (patch)
treec37c6a072dba2cb012d45bb11b8ffe835e992be1 /src
parentcf4d0a64e9909ff3c989a77f5d297dadc76e58e2 (diff)
iOS: Be more careful when hiding the keyboard upon enter
A typical pattern in an application is to listen for "enter" in a line edit and transfer focus to the next edit in the focus chain. This would currently not work on iOS since we would force the keyboard down after delivering the KeyPress/release events, effectively overriding any focus handling done by the app. This patch will hide the keyboard _before_ sending the events, so that we don't override focus handling done by the app. By also hiding the keyboard using QInputMethod, the hiding will also be delayed a bit (in QIOSInputContext) to catch subsequent hide/show calls. Change-Id: Ic19511d494a55d1bda963ed9bc7185d63b51bc03 Reviewed-by: Tor Arne Vestbø <>
Diffstat (limited to 'src')
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/platforms/ios/ b/src/plugins/platforms/ios/
index 79e3897013..03006b3f99 100644
--- a/src/plugins/platforms/ios/
+++ b/src/plugins/platforms/ios/
@@ -495,14 +495,14 @@ Q_GLOBAL_STATIC(StaticVariables, staticVariables);
if ([text isEqualToString:@"\n"]) {
+ if (self.returnKeyType == UIReturnKeyDone)
+ qApp->inputMethod()->hide();
QKeyEvent press(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
QKeyEvent release(QEvent::KeyRelease, Qt::Key_Return, Qt::NoModifier);
[self sendEventToFocusObject:press];
[self sendEventToFocusObject:release];
- if (self.returnKeyType == UIReturnKeyDone)
- [self resignFirstResponder];