diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index c5c5c132bc..18e17a340d 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -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([item tag]); + cocoaItem->hovered(); + } +} + - (void) menuWillOpen:(NSMenu*)m { Q_UNUSED(m); diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index fde46c9729..33d2e01ed7 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2998,6 +2998,7 @@ void QMenu::actionEvent(QActionEvent *e) QGuiApplicationPrivate::platformTheme()->createPlatformMenuItem(); menuItem->setTag(reinterpret_cast(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(e->before())); d->platformMenu->insertMenuItem(menuItem, beforeItem);