diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-05-13 19:36:51 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-07-07 11:49:27 +0200 |
commit | d7fc2fb5c666e58facfa15e64551a80dfda2c9d2 (patch) | |
tree | 4140e6e5cebb26a7820dd31f92286f504422d371 /src/gui | |
parent | 7ad5c5346f3298d90f12531231cd021768f1fb26 (diff) |
macOS: Remove QMenu indirection via QPlatformNativeInterface
Task-number: QTBUG-83252
Change-Id: I0c750d2b1912ced343d96ea0ca081c3319be2889
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qplatformmenu.h | 25 | ||||
-rw-r--r-- | src/gui/platform/macos/qcocoaplatforminterface.mm | 3 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h index 8e470aefd3..6c2abfde5f 100644 --- a/src/gui/kernel/qplatformmenu.h +++ b/src/gui/kernel/qplatformmenu.h @@ -166,6 +166,31 @@ public: virtual QPlatformMenu *createMenu() const; }; +// ----------------- QPlatformInterface ----------------- + +QT_END_NAMESPACE +Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu); +QT_BEGIN_NAMESPACE + +namespace QPlatformInterface::Private { + +#if defined(Q_OS_MACOS) +struct Q_GUI_EXPORT QCocoaMenu +{ + QT_DECLARE_PLATFORM_INTERFACE(QCocoaMenu) + virtual NSMenu *nsMenu() const = 0; + virtual void setAsDockMenu() const = 0; +}; + +struct Q_GUI_EXPORT QCocoaMenuBar +{ + QT_DECLARE_PLATFORM_INTERFACE(QCocoaMenuBar) + virtual NSMenu *nsMenu() const = 0; +}; +#endif + +} // QPlatformInterface::Private + QT_END_NAMESPACE #endif diff --git a/src/gui/platform/macos/qcocoaplatforminterface.mm b/src/gui/platform/macos/qcocoaplatforminterface.mm index a14335e077..daa821a794 100644 --- a/src/gui/platform/macos/qcocoaplatforminterface.mm +++ b/src/gui/platform/macos/qcocoaplatforminterface.mm @@ -42,6 +42,7 @@ #include <qpa/qplatformopenglcontext.h> #include <qpa/qplatformintegration.h> #include <qpa/qplatformwindow.h> +#include <qpa/qplatformmenu.h> #include <AppKit/AppKit.h> @@ -54,6 +55,8 @@ using namespace QPlatformInterface::Private; QT_DEFINE_PLATFORM_INTERFACE(QCocoaGLContext, QOpenGLContext); QT_DEFINE_PRIVATE_PLATFORM_INTERFACE(QCocoaGLIntegration); QT_DEFINE_PRIVATE_PLATFORM_INTERFACE(QCocoaWindow); +QT_DEFINE_PRIVATE_PLATFORM_INTERFACE(QCocoaMenu); +QT_DEFINE_PRIVATE_PLATFORM_INTERFACE(QCocoaMenuBar); QOpenGLContext *QPlatformInterface::QCocoaGLContext::fromNative(NSOpenGLContext *nativeContext, QOpenGLContext *shareContext) { |