diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-08-13 10:27:55 (GMT) |
---|---|---|
committer | Jesper Thomschutz <jesper.thomschutz@nokia.com> | 2010-08-16 12:07:59 (GMT) |
commit | 4fc3b97f1d4d0d8601616c1a0ec80c9af28cdcfd (patch) | |
tree | 15edeffe4f4033bd01d02cdffdec9dc9eb03e089 /src/gui/widgets | |
parent | c74a416ec459e262db0c55c7ef12b07a9768523b (diff) | |
download | Qt-4fc3b97f1d4d0d8601616c1a0ec80c9af28cdcfd.zip Qt-4fc3b97f1d4d0d8601616c1a0ec80c9af28cdcfd.tar.gz Qt-4fc3b97f1d4d0d8601616c1a0ec80c9af28cdcfd.tar.bz2 |
Multiple "Edit/Special Characters" menu entries on Mac OS X (Cocoa)
Every time [NSApp setMainMenu:] is called, Cocoa will add the 'Special
Characters' item to the 'Edit' menu. Before adding a new entry it will
make sure that menu items list doesn't contain an item with the selector
'orderFrontCharacterPalette' & a 'nil' target. We need to return the
index for the first entry (we have QCocoaMenuLoader as target).
Task-number: QTBUG-12842
Reviewed-by: Denis
(cherry picked from commit b52da4ab2179079a6aff95891786d2f6598048b5)
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qcocoamenu_mac.mm | 12 | ||||
-rw-r--r-- | src/gui/widgets/qcocoamenu_mac_p.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm index ce85919..15fae23 100644 --- a/src/gui/widgets/qcocoamenu_mac.mm +++ b/src/gui/widgets/qcocoamenu_mac.mm @@ -188,6 +188,18 @@ QT_USE_NAMESPACE return NO; } +- (NSInteger)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector +{ + NSInteger index = [super indexOfItemWithTarget:anObject andAction:actionSelector]; + static SEL selForOFCP = NSSelectorFromString(@"orderFrontCharacterPalette:"); + if (index == -1 && selForOFCP == actionSelector) { + // Check if the 'orderFrontCharacterPalette' SEL exists for QCocoaMenuLoader object + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)]; + return [super indexOfItemWithTarget:loader andAction:actionSelector]; + } + return index; +} + @end QT_BEGIN_NAMESPACE diff --git a/src/gui/widgets/qcocoamenu_mac_p.h b/src/gui/widgets/qcocoamenu_mac_p.h index d6ac8c5..1a42642 100644 --- a/src/gui/widgets/qcocoamenu_mac_p.h +++ b/src/gui/widgets/qcocoamenu_mac_p.h @@ -76,6 +76,7 @@ QT_FORWARD_DECLARE_CLASS(QAction) } - (id)initWithQMenu:(QMenu*)menu; - (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action; +- (NSInteger)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector; @end #endif |