diff options
Diffstat (limited to 'vcl/qt5/QtMenu.cxx')
-rw-r--r-- | vcl/qt5/QtMenu.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index e3494356fc8b..5b76706f22b3 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -457,6 +457,11 @@ void QtMenu::SetFrame(const SalFrame* pFrame) mpQMenuBar = new QMenuBar(); pMainWindow->setMenuBar(mpQMenuBar); + // open menu bar on F10, as is common in KF 6 and other toolkits: + // https://wordsmith.social/felix-ernst/f10-for-accessibility-in-kf6 + QShortcut* pQShortcut = new QShortcut(QKeySequence(Qt::Key_F10), mpQMenuBar->window()); + connect(pQShortcut, &QShortcut::activated, this, &QtMenu::slotShortcutF10); + QWidget* pWidget = mpQMenuBar->cornerWidget(Qt::TopRightCorner); if (pWidget) { @@ -697,6 +702,15 @@ void QtMenu::slotMenuBarButtonClicked(QAbstractButton* pButton) } } +void QtMenu::slotShortcutF10() +{ + SolarMutexGuard aGuard; + + // focus menu bar and select first item + if (mpQMenuBar && !mpQMenuBar->actions().empty()) + mpQMenuBar->setActiveAction(mpQMenuBar->actions().at(0)); +} + QPushButton* QtMenu::ImplAddMenuBarButton(const QIcon& rIcon, const QString& rToolTip, int nId) { if (!validateQMenuBar()) |