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

OS X disabled QAction delivers keypress event to focused widget

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.0 RC
    • 5.4.0 Beta
    • QPA
    • None
    • Cocoa, OS X 10.9.5, Qt 5.4.0 beta.
    • macOS

    Description

      If a menu contains a QAction with a shortcut, but the QAction is disabled, the keypress event associated with that shortcut is delivered to whatever widget has the focus.

      I have attached a sample application with a QMainWindow containing a QPlainTextEdit. The Edit menu has a single item, "Do Something" that triggers a QMessageBox. The action has the shortcut cmd-d. There is also a checkbox to enable or disable the menu item.

      With the checkbox turned on (menu item enabled) when you press Cmd-d the message box appears. With the checkbox turned off (menu item disabled) when you press Cmd-d a "d" appears in the QPlainTextEdit.

      When built with Qt 4.8.6, the disabled menu item does not cause characters to be added to the QPlainTextEdit.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            johnweeks John Weeks
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes