QCocoaMenu: Queue 'activated' signal emission

Allows catching exceptions without quitting the application.
The behavior change should be unnoticeable since we can't
activate the menu item from within the Qt application.

Tested that the keyboard modifiers are still set when we get
to the action signal handler.

Change-Id: I43d0c377834450344bd3a3678e07b6631ba0b768
Task-number: QTBUG-15197
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
This commit is contained in:
Gabriel de Dietrich 2015-03-27 19:39:32 +01:00 committed by Timur Pocheptsov
parent dce3561aa9
commit 08cc9b9991

View File

@ -37,6 +37,7 @@
#include "qcocoaautoreleasepool.h"
#include <QtCore/QtDebug>
#include <QtCore/qmetaobject.h>
#include <QtCore/private/qthread_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include "qcocoaapplication.h"
@ -124,7 +125,8 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate);
QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
QScopedLoopLevelCounter loopLevelCounter(QGuiApplicationPrivate::instance()->threadData);
QGuiApplicationPrivate::modifier_buttons = [QNSView convertKeyModifiers:[NSEvent modifierFlags]];
cocoaItem->activated();
static QMetaMethod activatedSignal = QMetaMethod::fromSignal(&QCocoaMenuItem::activated);
activatedSignal.invoke(cocoaItem, Qt::QueuedConnection);
}
- (BOOL)validateMenuItem:(NSMenuItem*)menuItem