iOS: send a Qt::Key_Return when the user hits done/enter
We need to send key events when the user hits enter, otherwise there is no way to know when the user has 'confirmed' the text he wrote. This is on par with how it's done for the Android port. Change-Id: I585d4198de24b0d251e5e0dd2956ce81b6483f82 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
parent
37ba38b334
commit
68c8016394
@ -492,8 +492,17 @@ Q_GLOBAL_STATIC(StaticVariables, staticVariables);
|
||||
if (!focusObject)
|
||||
return;
|
||||
|
||||
if ([text isEqualToString:@"\n"] && self.returnKeyType == UIReturnKeyDone)
|
||||
[self resignFirstResponder];
|
||||
if ([text isEqualToString:@"\n"]) {
|
||||
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;
|
||||
}
|
||||
|
||||
QInputMethodEvent e;
|
||||
e.setCommitString(QString::fromNSString(text));
|
||||
|
Loading…
Reference in New Issue
Block a user