Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Remove native Mac menu items such as Show Tab Bar

Remove native Mac menu items such as Show Tab Bar

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ArmanSom
    wrote on last edited by
    #1

    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,
    Arman

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

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

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mpergand
        wrote on last edited by
        #3

        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:

        macx{
        
        HEADERS +=		CocoaBridge.h 
        OBJECTIVE_SOURCES +=	CocoaBridge.mm
        
         LIBS +=		-framework AppKit
        }
        

        The C++ class looks like this:

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

        and CocoaBridge.mm :

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

        Should work ...

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved