diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2018-02-27 10:43:48 -0800 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2018-03-07 19:14:07 +0000 |
commit | e16c6dfb7286264ccdfd37d8e74c97f13ece7835 (patch) | |
tree | cbc206c63e84cf2f51240553cd101a28871e420c /src/plugins/platforms/cocoa/qcocoansmenu.h | |
parent | 4dee5446bee9c7417bf6f5dc44294a0b7238a9ba (diff) |
QCocoaMenuItem: Make QCocoaNSMenu the item target
Since we made the NSMenu delegate a singleton we could not rely
on it to have enough information to implement worksWhenModal.
At the same time as the delegate change, we derived NSMenu into
QCocoaNSMenu. This allows us to extend the menu functionality
and, in this case, serve as target for the Cocoa menu items.
We also refactor setting the item's target/action.
Manually tested against menurama and bigmenucreator tests, the
test-case for QTBUG-17291, and the richtext/textedit example.
Change-Id: I222241f71db82611711b23d4a8c6122a741370ae
Task-number: QTBUG-66676
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoansmenu.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoansmenu.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoansmenu.h b/src/plugins/platforms/cocoa/qcocoansmenu.h index 8fb0a26f27..a9c3e4fff9 100644 --- a/src/plugins/platforms/cocoa/qcocoansmenu.h +++ b/src/plugins/platforms/cocoa/qcocoansmenu.h @@ -68,8 +68,6 @@ typedef QPointer<QCocoaMenu> QCocoaMenuPointer; forKey:(NSString *)key modifiers:(NSUInteger)modifiers; -- (BOOL)validateMenuItem:(NSMenuItem *)item; // NSMenuValidation - @end @interface QT_MANGLE_NAMESPACE(QCocoaNSMenu) : NSMenu @@ -78,6 +76,11 @@ typedef QPointer<QCocoaMenu> QCocoaMenuPointer; - (instancetype)initWithQPAMenu:(QCocoaMenu *)menu; +- (void)qt_itemFired:(NSMenuItem *)item; + +- (BOOL)worksWhenModal; +- (BOOL)validateMenuItem:(NSMenuItem*)item; // NSMenuValidation + @end QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaNSMenu); |