Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-25743

QAction triggered in QMenu within QMenuBar even though the QMenu's menuAction is hidden/disabled.

    XMLWordPrintable

Details

    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.

      Attachments

        1. actionAlwaysCalled.zip
          2 kB
        2. main.cpp
          0.6 kB
        3. qtbug25743_121029.tar
          10 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vhilshei Volker Hilsheimer
            mgo Mgo Imamedjian
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes