From 220b2b92b62fb6c45a31e2a8f80e26f115166137 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 24 Apr 2013 14:00:28 +0200 Subject: Cocoa: Improve text heuristic menu item syncing logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't try anything after the original syncing, particularly after changing the menu item's text. Also, don't try anything if the menu item cannot be linked up to a menubar (see QTBUG-30756). This latter point requires extra syncing after adding a menu in the menubar. Finally, to be able to find the menubar, we need to clean the code for moc's eyes. Task-number: QTBUG-30756 Task-number: QTBUG-30812 Change-Id: I88fad663f1c35d03a0cb167d1723d16f590918c0 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoamenuitem.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/cocoa/qcocoamenuitem.h') diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.h b/src/plugins/platforms/cocoa/qcocoamenuitem.h index 0e6d17343d..1e69ed5a4b 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.h +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.h @@ -48,8 +48,16 @@ //#define QT_COCOA_ENABLE_MENU_DEBUG -@class NSMenuItem; -@class NSMenu; +#ifdef __OBJC__ +#define QT_FORWARD_DECLARE_OBJC_CLASS(__KLASS__) @class __KLASS__ +#else +#define QT_FORWARD_DECLARE_OBJC_CLASS(__KLASS__) typedef struct objc_object __KLASS__ +#endif + +QT_FORWARD_DECLARE_OBJC_CLASS(NSMenuItem); +QT_FORWARD_DECLARE_OBJC_CLASS(NSMenu); +QT_FORWARD_DECLARE_OBJC_CLASS(NSObject); + QT_BEGIN_NAMESPACE @@ -96,6 +104,7 @@ private: NSMenuItem *m_native; QString m_text; + bool m_textSynced; QIcon m_icon; QCocoaMenu *m_menu; bool m_isVisible; -- cgit v1.2.3