diff options
author | BogDan Vatra <bogdan@kde.org> | 2014-08-14 16:56:14 +0300 |
---|---|---|
committer | BogDan Vatra <bogdan@kde.org> | 2014-08-16 13:41:01 +0200 |
commit | ef4a999a9f098f4013759422e6a1dfb8c32c1180 (patch) | |
tree | 305d19a0507751f010a80265ddad0e7a601fc92b /src/gui/kernel | |
parent | eb5ef3312260479ada82e6463e7ec3a8b6245e7f (diff) |
Forward menu button events to Qt if there is no visible menubar.
Task-number: QTBUG-32334
Change-Id: If1b4517f233b04d4c6c165cbfe62c8cf7b624c60
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 12 | ||||
-rw-r--r-- | src/gui/kernel/qplatformtheme.h | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 9155abf8b9..2d7900b5d9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1886,11 +1886,17 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE ev.setAccepted(false); static bool backKeyPressAccepted = false; + static bool menuKeyPressAccepted = false; if (e->keyType == QEvent::KeyPress) { backKeyPressAccepted = e->key == Qt::Key_Back && ev.isAccepted(); - } else if (e->keyType == QEvent::KeyRelease && e->key == Qt::Key_Back && !backKeyPressAccepted && !ev.isAccepted()) { - if (window) - QWindowSystemInterface::handleCloseEvent(window); + menuKeyPressAccepted = e->key == Qt::Key_Menu && ev.isAccepted(); + } else if (e->keyType == QEvent::KeyRelease) { + if (e->key == Qt::Key_Back && !backKeyPressAccepted && !ev.isAccepted()) { + if (window) + QWindowSystemInterface::handleCloseEvent(window); + } else if (e->key == Qt::Key_Menu && !menuKeyPressAccepted && !ev.isAccepted()) { + platform_theme->showPlatformMenuBar(); + } } #endif } diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h index a2d14be0fb..ad2b4a2164 100644 --- a/src/gui/kernel/qplatformtheme.h +++ b/src/gui/kernel/qplatformtheme.h @@ -276,6 +276,7 @@ public: virtual QPlatformMenuItem* createPlatformMenuItem() const; virtual QPlatformMenu* createPlatformMenu() const; virtual QPlatformMenuBar* createPlatformMenuBar() const; + virtual void showPlatformMenuBar() {} virtual bool usePlatformNativeDialog(DialogType type) const; virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; |