Results 1 to 8 of 8

Thread: Double menu items on os x el capitan

  1. #1
    Join Date
    Aug 2015
    Posts
    15
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Double menu items on os x el capitan

    I'm having a problem with certain menu items displaying twice on OS X El Capitan.
    The menu items are created in designer so just generated code. If I remove my menu item
    with:
    Qt Code:
    1. ui->menu_View->removeAction(ui->action_exit_full_screen);
    To copy to clipboard, switch view to plain text mode 
    then no item shows at all. Any idea why?

    Screen Shot 2016-03-03 at 4.57.42 PM.jpg
    Screen Shot 2016-03-03 at 4.56.52 PM.jpg

  2. #2
    Join Date
    Aug 2015
    Posts
    15
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Double menu items on os x el capitan

    This is about all I could find related to this. From the OS X Developer Release Notes.
    https://developer.apple.com/library/...0_11FullScreen

    AppKit automatically creates an "Enter Full Screen" menu item after the application finishes launching if an equivalent menu item isn't found.
    If this menu item should not be created for your app, before NSApplicationDidFinishLaunchingNotification is sent you may set the
    NSFullScreenMenuItemEverywhere default to NO.
    Qt Code:
    1. (void)applicationWillFinishLaunching:(nonnull NSNotification *)notification {
    2. [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
    3. }
    To copy to clipboard, switch view to plain text mode 


    Is there a way I can leverage this in Qt?

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Double menu items on os x el capitan

    In your first post is the menu item without the shortcut yours? If so, perhaps creating yours with the shortcut will convince OS X it already has an " equivalent item."

  4. #4
    Join Date
    Aug 2015
    Posts
    15
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Double menu items on os x el capitan

    The shortcuts are mine... Tried a few different things including removing the menu item but haven't found anything that works.

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Double menu items on os x el capitan

    You could try creating your menu entry, waiting until the UI is shown (use a zero timer and a simple slot), and then removing/hiding your menu item leaving the OS X Auto-magic one. Yes, it would be an ugly hack.

    You can call Objective C functions from C++ if you jump through hoops
    http://stackoverflow.com/questions/1...-from-c-method

    I am not a Mac owner so I cannot be more specific.

  6. The following user says thank you to ChrisW67 for this useful post:

    rwhartzell (12th March 2016)

  7. #6
    Join Date
    Aug 2015
    Posts
    15
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Double menu items on os x el capitan

    You're timer idea was simple enough and works fine except theres no short cuts. I guess that will work until Qt catches up with El Capitan. Thanks for the pointer.

    For anyone interested this is what i did because i still build and run on Yosemite.

    In the constructor...
    Qt Code:
    1. #if defined Q_OS_MAC
    2. if (QSysInfo::productVersion() == "10.11") {
    3. QTimer *timer = new QTimer(this);
    4. timer->setSingleShot(true);
    5. connect(timer, SIGNAL(timeout()), this, SLOT(elCapitanMenuHack()));
    6. timer->start(0);
    7. }
    8. #endif
    To copy to clipboard, switch view to plain text mode 

    And then a private slot...
    Qt Code:
    1. void MainWindow::elCapitanMenuHack() {
    2. ui->menu_View->removeAction(ui->action_enter_full_screen);
    3. ui->menu_View->removeAction(ui->action_exit_full_screen);
    4. }
    To copy to clipboard, switch view to plain text mode 

  8. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Double menu items on os x el capitan

    You might like the QTimer::singleShot() static function.

  9. The following user says thank you to ChrisW67 for this useful post:

    rwhartzell (12th March 2016)

  10. #8
    Join Date
    Aug 2015
    Posts
    15
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Double menu items on os x el capitan

    Even better just needs to be set to a non zero value.

    Qt Code:
    1. #if defined Q_OS_MAC
    2. if (QSysInfo::productVersion() == "10.11") {
    3. QTimer::singleShot(1, this, SLOT(elCapitanMenuHack()));
    4. }
    5. #endif
    To copy to clipboard, switch view to plain text mode 

    Thanks again.

Similar Threads

  1. Implementing pinned menu items
    By wssddc in forum Qt Programming
    Replies: 1
    Last Post: 30th July 2013, 06:16
  2. Radio menu items in Designer
    By rbp in forum Qt Tools
    Replies: 0
    Last Post: 31st March 2009, 01:50
  3. designer not showing menu items ...
    By wagmare in forum Installation and Deployment
    Replies: 0
    Last Post: 24th February 2009, 11:26
  4. Want custom menu items, like graphics, but how?
    By rm in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2008, 21:52
  5. Checkboxes in menu items
    By markcole in forum Qt Programming
    Replies: 2
    Last Post: 4th June 2007, 16:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.