Solved MacOs, How to implement Preference menu to open custom dialog?
-
Hello,
I have an openPreferences action defined in the form. Within the form, the openPreference action is connected to the openPreferencesDialog slot. This works perfectly on all platforms, except on Mac.I also have other menus with "QuitRole", and "AboutRole". These work perfectly, even on Mac.
OPTION 1:
As per documentation, the openPreferences action has a menuRole of "PreferencesRole". On macOs, it renders "Preferences..." under the application menu. However, the "Preferences..." menu always invokes some other slot in the application (and not the openPreferencesDialog slot).OPTION 2:
When I set, "menuBar->setNativeMenuBar(false)", the menuBar gets painted within the application window. There is a "Preferences" menu in the application window, and "Preferences..." menu in the Mac application menubar at the top. Both the "Preferences" menus correctly open the preferences dialog. But, this makes for very bad user experience.QUESTION
My understanding is that Qt does preprocessing and moves the menus around for macOs. What am I doing wrong in OPTION 1? How can I get that to work?Thanks.
-
Hi,
Please show the code you use to build your menus.
-
@SGaist I used this link where you had also posted info.
https://forum.qt.io/topic/57852/solved-menu-bar-remains-stubbornly-invisible-on-mac-os-x-yosemite
The key was to set the parent of the menuBar to null. That resolved the problem.