summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorPasi Matilainen <pasi.matilainen@digia.com>2012-02-02 06:18:50 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-03-04 07:41:06 (GMT)
commit8f23a6be1069455e609e8bea7527726c24bebb36 (patch)
tree2e33be503bed77012ecb109cbbe120e2e4ef9a3b /src/gui
parent37212b8c063b456b036f87841e596ee7d857052f (diff)
downloadQt-8f23a6be1069455e609e8bea7527726c24bebb36.zip
Qt-8f23a6be1069455e609e8bea7527726c24bebb36.tar.gz
Qt-8f23a6be1069455e609e8bea7527726c24bebb36.tar.bz2
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>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm12
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac_p.h1
-rw-r--r--src/gui/mac/qt_menu.nib/keyedobjects.nibbin5560 -> 5560 bytes
3 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index ce30ad2..2a2fb50 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -260,5 +260,17 @@ QT_USE_NAMESPACE
{
[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
#endif // QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qcocoamenuloader_mac_p.h b/src/gui/kernel/qcocoamenuloader_mac_p.h
index 3be399f..a4a139f 100644
--- a/src/gui/kernel/qcocoamenuloader_mac_p.h
+++ b/src/gui/kernel/qcocoamenuloader_mac_p.h
@@ -89,6 +89,7 @@
- (IBAction)qtDispatcherToQAction:(id)sender;
- (void)qtUpdateMenubar;
- (void)orderFrontCharacterPalette:(id)sender;
+- (BOOL)validateMenuItem:(NSMenuItem*)menuItem;
@end
#endif // QT_MAC_USE_COCOA
diff --git a/src/gui/mac/qt_menu.nib/keyedobjects.nib b/src/gui/mac/qt_menu.nib/keyedobjects.nib
index 3edb0ed..67207ca 100644
--- a/src/gui/mac/qt_menu.nib/keyedobjects.nib
+++ b/src/gui/mac/qt_menu.nib/keyedobjects.nib
Binary files differ