PyQt6: Missing QAction.setMenu or equivalent

Dmitry Shachnev mitya57 at
Wed Apr 21 18:57:18 BST 2021


On Wed, Apr 21, 2021 at 03:58:36PM +0200, Ales Erjavec wrote:
> Hi
> In Qt6 QAction was moved to QtGui module and is therefore missing
> `setMenu(QMenu)`, `menu()` , or rather the methods are implemented as
> templates
> that will be instantiated only when called
> (
> How do we set a menu on an QAction in PyQt6 since `QAction.setMenu`
> does not exist?

If your use of QAction.setMenu was just to get a drop-down button in the
toolbar (like it was in my case), you can use a QToolButton for this.


Dmitry Shachnev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <>

More information about the PyQt mailing list