Fix menu duplication bug: make QCocoaMenu::addAction
do nothing before the native menu has ben created.
Change-Id: Ifca192421f2073264de9f5faeb053008ecb8532e
Reviewed-on: http://codereview.qt-project.org/5135
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
{
mPool = new QCocoaAutoReleasePool;
{
mPool = new QCocoaAutoReleasePool;
+ qApp->setAttribute(Qt::AA_DontUseNativeMenuBar, false);
+
QNSApplication *cocoaApplication = [QNSApplication sharedApplication];
// Applications launched from plain executables (without an app
QNSApplication *cocoaApplication = [QNSApplication sharedApplication];
// Applications launched from plain executables (without an app
QPlatformMenu *QCocoaIntegration::createPlatformMenu(QMenu *menu) const
{
QPlatformMenu *QCocoaIntegration::createPlatformMenu(QMenu *menu) const
{
- // return new QCocoaMenu(menu);
- return 0;
+ return new QCocoaMenu(menu);
}
QPlatformMenuBar *QCocoaIntegration::createPlatformMenuBar(QMenuBar *menuBar) const
{
}
QPlatformMenuBar *QCocoaIntegration::createPlatformMenuBar(QMenuBar *menuBar) const
{
- //return new QCocoaMenuBar(menuBar);
- return 0;
+ return new QCocoaMenuBar(menuBar);
}
QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
}
QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
void QCocoaMenu::addAction(QAction *a, QAction *before)
{
void QCocoaMenu::addAction(QAction *a, QAction *before)
{
+ if (menu == 0)
+ return;
+
QCocoaMenuAction *action = new QCocoaMenuAction;
action->action = a;
action->ignore_accel = 0;
QCocoaMenuAction *action = new QCocoaMenuAction;
action->action = a;
action->ignore_accel = 0;