Android: fix Menu and Back key handling
Don't quit on Back key release when Back shortcut was accepted and likewise for the Menu key, don't trigger the platform menubar if Menu shortcut was accepted. Change-Id: Ifde87cbc2d95be1beb90ca59f55889b83a90ff02 Task-number: QTBUG-59670 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>bb10
parent
3d7c4e064f
commit
49163ca689
|
|
@ -2027,13 +2027,23 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
|
|||
window = QGuiApplication::focusWindow();
|
||||
}
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
static bool backKeyPressAccepted = false;
|
||||
static bool menuKeyPressAccepted = false;
|
||||
#endif
|
||||
|
||||
#if !defined(Q_OS_OSX)
|
||||
// FIXME: Include OS X in this code path by passing the key event through
|
||||
// QPlatformInputContext::filterEvent().
|
||||
if (e->keyType == QEvent::KeyPress && window) {
|
||||
if (QWindowSystemInterface::handleShortcutEvent(window, e->timestamp, e->key, e->modifiers,
|
||||
e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, e->unicode, e->repeat, e->repeatCount))
|
||||
e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, e->unicode, e->repeat, e->repeatCount)) {
|
||||
#if defined(Q_OS_ANDROID)
|
||||
backKeyPressAccepted = e->key == Qt::Key_Back;
|
||||
menuKeyPressAccepted = e->key == Qt::Key_Menu;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2050,8 +2060,6 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
|
|||
else
|
||||
ev.setAccepted(false);
|
||||
|
||||
static bool backKeyPressAccepted = false;
|
||||
static bool menuKeyPressAccepted = false;
|
||||
if (e->keyType == QEvent::KeyPress) {
|
||||
backKeyPressAccepted = e->key == Qt::Key_Back && ev.isAccepted();
|
||||
menuKeyPressAccepted = e->key == Qt::Key_Menu && ev.isAccepted();
|
||||
|
|
|
|||
Loading…
Reference in New Issue