Fix incorrect state of show/hide menu items in Mac application menu
The "Hide <app>", "Hide Others" and "Show All" menu items in Mac application menu are always enabled, and do not get disabled correctly. Fix by turning on autoenable for the menu in qt_menu.nib, and by implementing menu item validation in QCocoaMenuLoader. Task-number: QTBUG-10705 Change-Id: Ic181dfa26a71acad0067f5269c72517b50b17362 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> (cherry picked from commit 8f23a6be1069455e609e8bea7527726c24bebb36)
This commit is contained in:
parent
73db181e83
commit
b3670edba4
@ -88,6 +88,7 @@
|
||||
- (IBAction)qtDispatcherToQAction:(id)sender;
|
||||
- (void)qtUpdateMenubar;
|
||||
- (void)orderFrontCharacterPalette:(id)sender;
|
||||
- (BOOL)validateMenuItem:(NSMenuItem*)menuItem;
|
||||
@end
|
||||
|
||||
void qt_mac_loadMenuNib(QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader);
|
||||
|
@ -310,4 +310,16 @@ void qt_mac_loadMenuNib(QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader)
|
||||
{
|
||||
[NSApp orderFrontCharacterPalette:sender];
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem*)menuItem
|
||||
{
|
||||
if ([menuItem action] == @selector(hide:)
|
||||
|| [menuItem action] == @selector(hideOtherApplications:)
|
||||
|| [menuItem action] == @selector(unhideAllApplications:)) {
|
||||
return [NSApp validateMenuItem:menuItem];
|
||||
} else {
|
||||
return [menuItem isEnabled];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
BIN
src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib
generated
BIN
src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib
generated
Binary file not shown.
Loading…
Reference in New Issue
Block a user