Qt 5.4.2 + OS X 10.11 (El Capitan): how to remove the "Enter Full Screen" menu item?



  • Hi,

    I have just noticed that my application (which, on OS X, works with 10.7 and later) has a new View | Enter Full Screen menu on OS X 10.11 (El Capitan). This menu is not present on 10.10 and before.

    Now, I have been supporting the full screen mode for some time in my application, so I already have a View | Full Screen menu. That 'new' menu is therefore redundant with what my application already offers. I thought I would, on OS X 10.11, remove my 'old' menu and thus have the 'new' one do the job for me. However, after having played with the 'new' menu, I can see that it's not working as I would expect. For example, if I start my application, select the View | Enter Full Screen menu, quit my application and restart it, my application will, as expected, be in full screen mode. However, if I now select what has become the View | Exit Full Screen menu, my application is not in full screen mode, but it's nonetheless maximised while I would have expected it to retrieve the size it had before it entered full screen mode. This is how my 'old' menu works and this is what I would have expected to see.

    So, since the 'new' menu doesn't work as I would expect, I was wondering whether there would be a way to hide that View | Enter Full Screen menu?...

    Cheers, Alan.



  • Am also looking for disabling OSX full screen menu ... Any solutions found ??



  • @Ramya-Ezhilarasan Personally, I (still) haven't found a solution. Sorry.



  • FWIW, I have now solved that problem (and other similar ones with macOS):

    // Remove (disable) the "Start Dictation..." and "Emoji & Symbols" menu items
    // from the "Edit" menu
    
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"];
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledCharacterPaletteMenuItem"];
    
    #ifdef AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
    // Remove (don't allow) the "Show Tab Bar" menu item from the "View" menu, if
    // supported
    
    if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
        NSWindow.allowsAutomaticWindowTabbing = NO;
    #endif
    
    // Remove (don't have) the "Enter Full Screen" menu item from the "View" menu
    
    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
    


  • @agarny Sorry if I'm a bit oblivious. This seems like you're adding Objective-C (C++) to your project.

    Can you provide some small detail (or a link) on what you do?

    I'm guessing you have your main.m include a mix of Qt and Objective-C when you set things up?



  • @ghutchis, here are some links that should make you understand what I did and how I did it:

    For another example that shows mixing Qt C++ and Objective C (using QMake this time):

    HTH



  • @agarny That's great - I was doing almost the same - but after looking at your examples, I realized the code wasn't calling the method in mac.mm.

    CMake also needed me to add linker flags for Cocoa:
    set(CMAKE_EXE_LINKER_FLAGS "-framework Foundation -framework Cocoa")

    Thanks so much for your helpful post!



  • @ghutchis, oops, I indeed forgot to provide you with a link for updating the linker flags. Personally, and FWIW, I have the following:

    SET(LINK_FLAGS_PROPERTIES "${LINK_FLAGS_PROPERTIES} -framework AppKit")
    

Log in to reply
 

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