diff options
author | Romain Perier <romain.perier@gmail.com> | 2013-05-11 09:28:53 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-16 10:45:04 +0200 |
commit | 94c7002df30d931df13b3bae9d4c46ff1e6f714c (patch) | |
tree | 17cb12d18eb5437ad4fbf16f5e8d2804924ffcaa /src/plugins/platforms/cocoa/qcocoamenu.mm | |
parent | adaa50e37da1fddada874a289792a1bd95c5aebc (diff) |
Improve Qt-in-namespace implementation in the Cocoa platform plugin
Objective-C++ does not support namespaces. In order to make this work,
we decorate each symbol with suffix using the macro QT_MANGLE_NAMESPACE.
However, with such a technic each public symbol needs to be explicitly exported through
this macro. The use of @compatibility_alias allows to define alias to use it
automatically and transparently.
Task-number: QTBUG-23946
Change-Id: Id521b8160bab126fda40a9d960277b1c04cc8b66
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoamenu.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenu.mm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index c5c5c132bc..0a98819d16 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -73,7 +73,7 @@ NSString *qt_mac_removePrivateUnicode(NSString* string) return string; } -static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader() +static inline QCocoaMenuLoader *getMenuLoader() { return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)]; } @@ -86,7 +86,9 @@ static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader() @end -@implementation QT_MANGLE_NAMESPACE(QCocoaMenuDelegate) +QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate); + +@implementation QCocoaMenuDelegate - (id) initWithMenu:(QCocoaMenu*) m { @@ -207,11 +209,11 @@ QCocoaMenu::QCocoaMenu() : m_enabled(true), m_tag(0) { - m_delegate = [[QT_MANGLE_NAMESPACE(QCocoaMenuDelegate) alloc] initWithMenu:this]; + m_delegate = [[QCocoaMenuDelegate alloc] initWithMenu:this]; m_nativeItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; m_nativeMenu = [[NSMenu alloc] initWithTitle:@"Untitled"]; [m_nativeMenu setAutoenablesItems:YES]; - m_nativeMenu.delegate = (QT_MANGLE_NAMESPACE(QCocoaMenuDelegate) *) m_delegate; + m_nativeMenu.delegate = (QCocoaMenuDelegate *) m_delegate; [m_nativeItem setSubmenu:m_nativeMenu]; } |