Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.10.1, 5.11.0 Beta 2, 5.14.2, 5.15.0
-
None
-
Windows
Ubuntu 16.04 64-bit
Description
As described in the documentation for QAction :
"An action will be disabled when all widgets to which it is added (with QWidget::addAction()) are disabled or not visible. When an action is disabled, it is not possible to trigger it through its shortcut."
To reproduce (see qtbug25743):
- Add a QMenu to a QMenuBar
- Add an action with shortcut to the QMenu
- call setVisible(false)/setEnabled(false) on the menu's menuAction()
- Invoke shortcut: The action still fires
Note that for example for a menu added to a QPushButton, the action no longer fires if the button is invisible/disabled.