diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-07-30 01:59:31 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-08-01 08:21:22 +0200 |
commit | 2ef9880f97de6629ddef12eb788123ab4be1ec83 (patch) | |
tree | d87a40daaba53ad5cf9a4192a0e275513717daef /vcl/inc/qt5/QtMenu.hxx | |
parent | 85c07891ad9424661d8e1adb8e93364e3964ce34 (diff) |
tdf#156376 qt: Open help for focused native menu entry on F1
In order to allow have pressing F1 (`QKeySequence::HelpContents`)
open the corresponding help entry for the currently selected
menu entry, connect to the signal that gets emitted when
a menu entry is selected (`QAction::hovered`) and remember
its help ID. Register the F1 shortcut for the menu
and connect its `activated`/`activatedAmbiguously`
signal with a slot that opens the help for the current/
last selected menu entry.
Change-Id: I24eec4806e5a202052a49c239e4836b92c9f0228
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155055
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/inc/qt5/QtMenu.hxx')
-rw-r--r-- | vcl/inc/qt5/QtMenu.hxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx index 3e43272b6212..bd704507f69c 100644 --- a/vcl/inc/qt5/QtMenu.hxx +++ b/vcl/inc/qt5/QtMenu.hxx @@ -53,6 +53,9 @@ private: QMenu* mpQMenu; QButtonGroup* m_pButtonGroup; + // help ID of currently/last selected item + static OUString m_sCurrentHelpId; + void DoFullMenuUpdate(Menu* pMenuBar); static void NativeItemText(OUString& rItemText); @@ -64,6 +67,9 @@ private: bool validateQMenuBar() const; QPushButton* ImplAddMenuBarButton(const QIcon& rIcon, const QString& rToolTip, int nId); void ImplRemoveMenuBarButton(int nId); + void connectHelpShortcut(QMenu* pMenu); + // set slots that handle signals relevent for help menu + void connectHelpSignalSlots(QMenu* pMenu, QtMenuItem* pSalMenuItem); public: QtMenu(bool bMenuBar); @@ -102,6 +108,8 @@ public: QtMenuItem* GetItemAtPos(unsigned nPos) { return maItems[nPos]; } private slots: + static void slotShowHelp(); + static void slotMenuHovered(QtMenuItem* pItem); static void slotMenuTriggered(QtMenuItem* pQItem); static void slotMenuAboutToShow(QtMenuItem* pQItem); static void slotMenuAboutToHide(QtMenuItem* pQItem); |