src/gui/kernel/qcocoamenuloader_mac.mm
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    74     [aboutItem setHidden:YES];
    74     [aboutItem setHidden:YES];
    75 }
    75 }
    76 
    76 
    77 - (void)ensureAppMenuInMenu:(NSMenu *)menu
    77 - (void)ensureAppMenuInMenu:(NSMenu *)menu
    78 {
    78 {
       
    79     // The application menu is the menu in the menu bar that contains the
       
    80     // 'Quit' item. When changing menu bar (e.g when swithing between
       
    81     // windows with different menu bars), we never recreate this menu, but
       
    82     // instead pull it out the current menu bar and place into the new one:
    79     NSMenu *mainMenu = [NSApp mainMenu];
    83     NSMenu *mainMenu = [NSApp mainMenu];
    80     if ([NSApp mainMenu] == menu)
    84     if ([NSApp mainMenu] == menu)
    81         return; // nothing to do!
    85         return; // nothing to do (menu is the current menu bar)!
       
    86 
    82 #ifndef QT_NAMESPACE
    87 #ifndef QT_NAMESPACE
    83     Q_ASSERT(mainMenu);
    88     Q_ASSERT(mainMenu);
    84 #endif
    89 #endif
    85     // Grab the app menu out of the current menu.
    90     // Grab the app menu out of the current menu.
    86     int numItems = [mainMenu numberOfItems];
    91     int numItems = [mainMenu numberOfItems];