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

[Reg 5.7.1-5.8.0][Cocoa] Shortcuts don't work without native menubar

    XMLWordPrintable

Details

    • macOS
    • 198225983df9f402bb368b449f1abeea95ff0dce

    Description

      When QMenuBar::nativeMenuBar is set to false, action shortcuts don't work. The problem was introduced with https://codereview.qt-project.org/#/c/173958/. Before this patch QMenu always created a platform menu instance at construction time, but now the platform menu instance is created only when needed. Now, when native menubar is not used and the platform menu instance is not created, the shortcuts are not delivered. Thus, it seems that correct shortcut delivery needs a platform menu instance.

      As a workaround one can put back the setPlatformMenu() call, which was removed from src/widgets/widgets/qmenu.cpp, QMenu::init() in the above mentioned fix patch, but note that it will bring the crash in Unity (-QTBUG-56526-).

      The attached example can be used to reproduce the problem. 'q' and 'e' keys are set as action shortcuts and they are connected to slots printing "Shortcut q" and "Shortcut e", which are not hit when QMenuBar::nativeMenuBar is false.

      Attachments

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

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes