2 Attachment(s)
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:
Code:
ui->menu_View->removeAction(ui->action_exit_full_screen);
then no item shows at all. Any idea why?
Attachment 11764
Attachment 11765
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.
Code:
(void)applicationWillFinishLaunching:(nonnull NSNotification *)notification {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
}
Is there a way I can leverage this in Qt?
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."
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.
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.
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...
Code:
#if defined Q_OS_MAC
if (QSysInfo::productVersion() == "10.11") { timer->setSingleShot(true);
connect(timer, SIGNAL(timeout()), this, SLOT(elCapitanMenuHack()));
timer->start(0);
}
#endif
And then a private slot...
Code:
void MainWindow::elCapitanMenuHack() {
ui->menu_View->removeAction(ui->action_enter_full_screen);
ui->menu_View->removeAction(ui->action_exit_full_screen);
}
Re: Double menu items on os x el capitan
You might like the QTimer::singleShot() static function.
Re: Double menu items on os x el capitan
Even better just needs to be set to a non zero value.
Code:
#if defined Q_OS_MAC
if (QSysInfo::productVersion() == "10.11") { QTimer::singleShot(1,
this,
SLOT(elCapitanMenuHack
()));
}
#endif
Thanks again.