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:
parent
dce3561aa9
commit
08cc9b9991
@ -37,6 +37,7 @@
|
|||||||
#include "qcocoaautoreleasepool.h"
|
#include "qcocoaautoreleasepool.h"
|
||||||
|
|
||||||
#include <QtCore/QtDebug>
|
#include <QtCore/QtDebug>
|
||||||
|
#include <QtCore/qmetaobject.h>
|
||||||
#include <QtCore/private/qthread_p.h>
|
#include <QtCore/private/qthread_p.h>
|
||||||
#include <QtGui/private/qguiapplication_p.h>
|
#include <QtGui/private/qguiapplication_p.h>
|
||||||
#include "qcocoaapplication.h"
|
#include "qcocoaapplication.h"
|
||||||
@ -124,7 +125,8 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate);
|
|||||||
QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
|
QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
|
||||||
QScopedLoopLevelCounter loopLevelCounter(QGuiApplicationPrivate::instance()->threadData);
|
QScopedLoopLevelCounter loopLevelCounter(QGuiApplicationPrivate::instance()->threadData);
|
||||||
QGuiApplicationPrivate::modifier_buttons = [QNSView convertKeyModifiers:[NSEvent modifierFlags]];
|
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
|
- (BOOL)validateMenuItem:(NSMenuItem*)menuItem
|
||||||
|
Loading…
Reference in New Issue
Block a user