diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2014-05-23 10:51:19 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-23 14:46:19 +0200 |
commit | 28f32afd3fed07c7772b76faf731bb104810d934 (patch) | |
tree | c37c6a072dba2cb012d45bb11b8ffe835e992be1 /src/plugins | |
parent | cf4d0a64e9909ff3c989a77f5d297dadc76e58e2 (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ø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/ios/quiview_textinput.mm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/platforms/ios/quiview_textinput.mm b/src/plugins/platforms/ios/quiview_textinput.mm index 79e3897013..03006b3f99 100644 --- a/src/plugins/platforms/ios/quiview_textinput.mm +++ b/src/plugins/platforms/ios/quiview_textinput.mm @@ -495,14 +495,14 @@ Q_GLOBAL_STATIC(StaticVariables, staticVariables); return; 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]; - return; } |