Simulate QMenu hover on a QAction?

Matic Kukovec kukovecmatic at hotmail.com
Tue Jul 27 08:32:49 BST 2021


Hello Maurizio,

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.
Could this be the issue? This is how it looks like:
[cid:01e95d92-b603-47e5-bdef-81489934eba0]
Only when the item action with the arrow at the end is clicked, only then the sub-menu appears. Is it possible to make it appear when just  hovering over the QWidgetAction?

Thanks,
Matic

________________________________
From: Maurizio Berti <maurizio.berti at gmail.com>
Sent: Tuesday, July 27, 2021 5:53 AM
To: Matic Kukovec <kukovecmatic at hotmail.com>
Cc: pyqt at riverbankcomputing.com <pyqt at riverbankcomputing.com>
Subject: Re: Simulate QMenu hover on a QAction?

I'm not sure I'm understanding your question.
If you add a QAction to a QMenu and that action has a menu set with setMenu(), it will behave exactly like adding a submenu, as it fundamentally does the same thing: menu.addMenu Qt actually adds the menuAction for that menu, so it's the same as doing addAction with an action that has a menu.

Il giorno lun 26 lug 2021 alle ore 09:39 Matic Kukovec <kukovecmatic at hotmail.com<mailto:kukovecmatic at hotmail.com>> ha scritto:
Hi guys,

I have a QMenu that has QActions with menus. This works great, but to show a QAction's menu,
it is needed to click on the action for it to appear.

Is it possible to make the QAction's menu appear on mouse hover, the same as for a sub-QMenu in a QMenu?

Thanks,
Matic



--
È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210727/dd88e04b/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ZovLGHbLW6.gif
Type: image/gif
Size: 222439 bytes
Desc: ZovLGHbLW6.gif
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210727/dd88e04b/attachment-0001.gif>


More information about the PyQt mailing list