iOS: send backspace events directly

For legacy reasons, we send IM events to the focus
object directly instead of through QPA. To be consistent,
and to ensure that IM and key events end up at the same
object in the same order, we need to send key events
directly to the focus object as well.
We should consider fixing up QPA to support IM events
better, but this will do for now.

Change-Id: I8a18a1f7b7295e5c64a109fb98eee928fae06a0f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
Richard Moe Gustavsen 2014-01-30 16:39:17 +01:00 committed by The Qt Project
parent 35dc77f8db
commit 6b212351e2

View File

@ -467,11 +467,13 @@ Q_GLOBAL_STATIC(StaticVariables, staticVariables);
- (void)deleteBackward
{
// Send key event to window system interface
QWindowSystemInterface::handleKeyEvent(
0, QEvent::KeyPress, (int)Qt::Key_Backspace, Qt::NoModifier);
QWindowSystemInterface::handleKeyEvent(
0, QEvent::KeyRelease, (int)Qt::Key_Backspace, Qt::NoModifier);
// Since we're posting im events directly to the focus object, we should do the
// same for key events. Otherwise they might end up in a different place or out
// of sync with im events.
QKeyEvent press(QEvent::KeyPress, (int)Qt::Key_Backspace, Qt::NoModifier);
QKeyEvent release(QEvent::KeyRelease, (int)Qt::Key_Backspace, Qt::NoModifier);
[self sendEventToFocusObject:press];
[self sendEventToFocusObject:release];
}
- (void)updateTextInputTraits