Simulate QMenu hover on a QAction?

Matic Kukovec kukovecmatic at
Wed Jul 28 10:37:17 BST 2021

Hello again,

For anyone looking at this thread, the problem is that the widgets added to the QWidgetAction with .setDefaultWidget consume the mouseMoveEvent, which needs to be ignored.
The solution is to enable mouse tracking on all widgets in the added to the QWidgetAction with .setMouseTracking(True) and then overriding the mouseMoveEvent method and ignoring the event in every widget, like so:
def mouseMoveEvent(self, event):

Thanks for the hints
From: Maurizio Berti <maurizio.berti at>
Sent: Tuesday, July 27, 2021 4:16 PM
To: Matic Kukovec <kukovecmatic at>
Cc: pyqt at <pyqt at>
Subject: Re: Simulate QMenu hover on a QAction?

Il giorno mar 27 lug 2021 alle ore 09:33 Matic Kukovec <kukovecmatic at<mailto:kukovecmatic at>> ha scritto:
I just rechecked, and yes, I'm not using a QAction, but a QWidgetAction on which I first set a default widget with setDefaultWidget,
which is a groupbox with a few labels with text/images, then add a menu with setMenu.

Uhm. I see a QComboBox that shows what appears to be a QMenu instead of the standard popup, so, yes, that could be the issue, especially if you're overriding the popup behavior on mouse press.
I suggest you to share a minimal reproducible example so that we could better understand what's going on.

È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the PyQt mailing list