qquickwindow: handle QEvent::ShortcutOverride

After qtbase:c7e5e1d, QEvent::ShortcutOverride is no longer sent
directly to the focus object, but to the window. But since
QQuickWindow didn't catch it, it ended up nowhere.

This patch will implement the same strategy as QWidgetWindow, and
let QQuickWindow forward the ShortcutOverride event the same way
as key events.

Note that even if the event was never being delivered, the corresponding
key events would still end up in the focus object and trigger shortcuts.
But if a window global shortcut existed with the same key sequence, it would
grab the shortcut instead of the override, which was wrong.

Change-Id: I4ad7b3879adac14d88a3fbce5851409d0963d163
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Richard Moe Gustavsen 2015-11-18 15:17:14 +01:00 committed by Tor Arne Vestbø
parent fe2e7b7340
commit 86a8bcede0
1 changed files with 7 additions and 0 deletions

View File

@ -1406,6 +1406,10 @@ bool QQuickWindow::event(QEvent *e)
d->deliverNativeGestureEvent(d->contentItem, static_cast<QNativeGestureEvent*>(e));
break;
#endif
case QEvent::ShortcutOverride:
if (d->activeFocusItem)
sendEvent(d->activeFocusItem, static_cast<QKeyEvent *>(e));
return true;
default:
break;
}
@ -2584,6 +2588,9 @@ bool QQuickWindow::sendEvent(QQuickItem *item, QEvent *e)
QCoreApplication::sendEvent(item, e);
}
break;
case QEvent::ShortcutOverride:
QCoreApplication::sendEvent(item, e);
break;
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick: