OS X Unified toolbar Preferences not working
-
I'm not an Mac user so please forgive me if I'm using wrong terminology or if I'm missing something very obvious.
I have a Qt application which works very well on Windows and Linux. Now I'd like to add OS-X support (I want to provide a pre-build package/bundle).
In myQMainWindowI have twoQMenuwith the following entries to open dialogs: File -> Preferences and Project -> Settings. The idea is that thePreferencesare the application preferences themselves where theSettingsare the settings of the project that is currently opened in the application.
Apparently the unified toolbar recognizes thePreferencesmenu entry and moves it from theFilesmenu to a different menu entry (the application entry which is written in bold).
My main problem is that theSettingsmenu entry which used to be in theProjectmenu is gone completely. Furthermore thePreferencesmenu entry is disabled. This is due to the fact that I disable theProject -> Settingsmenu entry if there's no project loaded in the application. This indicates that the unified toolbar also messes around with theSettingsentry.I have absolutely no idea what causes this issue and whether it's supposed to be that way or whether it's a bug. I would appreciate any kind help to resolve this issue.
-
Wild guess here:
Try settingQt::AA_DontUseNativeMenuBaras Application Attribute -
@VRonin Thank you for your suggestion!
Interestingly that doesn't have any effect. The application still uses the unified menubar.
I set the attribute like this in mymain()before I construct and show theQMainWindow:QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);Interestingly I get the following debug messages in the application output pane when opening and closing the application when the attribute is set to true:
Menu item is already in a menu, remove it from the other menu first before inserting Menu item is already in a menu, remove it from the other menu first before inserting Menu item is already in a menu, remove it from the other menu first before inserting Menu item is already in a menu, remove it from the other menu first before inserting Item to remove does not belong to this menu Item to remove does not belong to this menu Item to remove does not belong to this menu Item to remove does not belong to this menuI also tried
QMainWindow::setUnifiedTitleAndToolBarOnMac()but without any success either. The application still uses the unified toolbar.I'm using Qt 5.6 on OS X 10.11.4 (El Capitan)