Ensure the hovered signal is emitted for the action and menu for Cocoa

In the Cocoa platform plugin the hovered signal() was not being emitted
for the corresponding QMenu. This now ensures it is emitted for the
action itself and its QMenu.

Task-number: QTBUG-30841
Change-Id: I3cfe634a71de7b55550e2561eb1c6a939536216d
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Andy Shaw 2013-05-09 01:46:52 +02:00 committed by The Qt Project
parent a77e4ea207
commit 12e84748aa
2 changed files with 11 additions and 0 deletions

View File

@ -96,6 +96,16 @@ static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader()
return self;
}
- (void)menu:(NSMenu*)menu willHighlightItem:(NSMenuItem*)item
{
Q_UNUSED(menu);
if (item && [item tag]) {
QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
cocoaItem->hovered();
}
}
- (void) menuWillOpen:(NSMenu*)m
{
Q_UNUSED(m);

View File

@ -2998,6 +2998,7 @@ void QMenu::actionEvent(QActionEvent *e)
QGuiApplicationPrivate::platformTheme()->createPlatformMenuItem();
menuItem->setTag(reinterpret_cast<quintptr>(e->action()));
QObject::connect(menuItem, SIGNAL(activated()), e->action(), SLOT(trigger()));
QObject::connect(menuItem, SIGNAL(hovered()), e->action(), SIGNAL(hovered()));
copyActionToPlatformItem(e->action(), menuItem);
QPlatformMenuItem* beforeItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->before()));
d->platformMenu->insertMenuItem(menuItem, beforeItem);