Remove native Mac menu items such as Show Tab Bar

  • It seems that the action - Show Tab Bar - automatically inserts itself into the View menu that I create.

    I would like to keep the menu named as is. Is it possible to remove the system menu action through the Qt API? If not, may I have suggestions for non-Qt solutions?

    Thank you,

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    If you don't have any tool bar then you can use QMainWindow::setUnifiedTitleAndToolBarOnMac.

    Hope it helps

  • According to this topic : how-do-i-disable-the-show-tab-bar
    you need to call:
    [NSWindow setAllowsAutomaticWindowTabbing: NO];

    For doing that, you have to create a C++ class (named CocoaBridge here) with .mm extension.

    Add it to your .pro file:

    HEADERS +=		CocoaBridge.h 
     LIBS +=		-framework AppKit

    The C++ class looks like this:

    #ifndef COCOABRIDGE_H
    #define COCOABRIDGE_H
    class CocoaBridge
    	CocoaBridge() {}
        static void setAllowsAutomaticWindowTabbing(bool flag);
    #endif // COCOABRIDGE_H

    and :

    #include "CocoaBridge.h"
    #import <Cocoa/Cocoa.h>
    void  CocoaBridge::setAllowsAutomaticWindowTabbing(bool flag)
    	[NSWindow setAllowsAutomaticWindowTabbing: flag];

    Should work ...

Log in to reply

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