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 my QMainWindow I have two QMenu with the following entries to open dialogs: File -> Preferences and Project -> Settings. The idea is that the Preferences are the application preferences themselves where the Settings are the settings of the project that is currently opened in the application.
    Apparently the unified toolbar recognizes the Preferences menu entry and moves it from the Files menu to a different menu entry (the application entry which is written in bold).
    My main problem is that the Settings menu entry which used to be in the Project menu is gone completely. Furthermore the Preferences menu entry is disabled. This is due to the fact that I disable the Project -> Settings menu entry if there's no project loaded in the application. This indicates that the unified toolbar also messes around with the Settings entry.

    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 setting Qt::AA_DontUseNativeMenuBar as 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 my main() before I construct and show the QMainWindow:

    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 menu
    

    I 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)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.