From e16c6dfb7286264ccdfd37d8e74c97f13ece7835 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 27 Feb 2018 10:43:48 -0800 Subject: QCocoaMenuItem: Make QCocoaNSMenu the item target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/platforms/cocoa/qcocoamenu.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/platforms/cocoa/qcocoamenu.h') diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h index 2b4cf0ef98..6db4e04c61 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.h +++ b/src/plugins/platforms/cocoa/qcocoamenu.h @@ -96,6 +96,8 @@ public: void syncMenuItem_helper(QPlatformMenuItem *menuItem, bool menubarUpdate); + void setItemTargetAction(QCocoaMenuItem *item) const; + private: QCocoaMenuItem *itemOrNull(int index) const; void insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem); -- cgit v1.2.3