Cocoa: export setDockMenu
Change-Id: I1eb35c34427660d2662f310a3e8c4e5ba42e08eb Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>bb10
parent
9ef48277f9
commit
5f71203dd0
|
|
@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
|
|||
class QWidget;
|
||||
class QPlatformPrinterSupport;
|
||||
class QPrintEngine;
|
||||
class QPlatformMenu;
|
||||
|
||||
class QCocoaNativeInterface : public QPlatformNativeInterface
|
||||
{
|
||||
|
|
@ -92,6 +93,9 @@ private:
|
|||
static void addToMimeList(void *macPasteboardMime);
|
||||
static void removeFromMimeList(void *macPasteboardMime);
|
||||
static void registerDraggedTypes(const QStringList &types);
|
||||
|
||||
// Dock menu support
|
||||
static void setDockMenu(QPlatformMenu *platformMenu);
|
||||
};
|
||||
|
||||
#endif // QCOCOANATIVEINTERFACE_H
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "qcocoanativeinterface.h"
|
||||
#include "qcocoaglcontext.h"
|
||||
#include "qcocoawindow.h"
|
||||
#include "qcocoamenu.h"
|
||||
#include "qcocoamenubar.h"
|
||||
#include "qmacmime.h"
|
||||
|
||||
|
|
@ -60,6 +61,8 @@
|
|||
#include <qpa/qplatformprintersupport.h>
|
||||
#endif
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QCocoaNativeInterface::QCocoaNativeInterface()
|
||||
|
|
@ -103,6 +106,8 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter
|
|||
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::removeFromMimeList);
|
||||
if (resource.toLower() == "registerdraggedtypes")
|
||||
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerDraggedTypes);
|
||||
if (resource.toLower() == "setdockmenu")
|
||||
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setDockMenu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -170,4 +175,12 @@ void QCocoaNativeInterface::registerDraggedTypes(const QStringList &types)
|
|||
qt_mac_registerDraggedTypes(types);
|
||||
}
|
||||
|
||||
void QCocoaNativeInterface::setDockMenu(QPlatformMenu *platformMenu)
|
||||
{
|
||||
QCocoaMenu *cocoaPlatformMenu = static_cast<QCocoaMenu *>(platformMenu);
|
||||
NSMenu *menu = cocoaPlatformMenu->nsMenu();
|
||||
// setDockMenu seems to be undocumented, but this is what Qt 4 did.
|
||||
[NSApp setDockMenu: menu];
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
Loading…
Reference in New Issue