PyQt6 QAction menu/setMenu?
Dmitry Shachnev
mitya57 at ubuntu.com
Sun Jul 17 19:01:39 BST 2022
Hi all,
On Sun, Jul 17, 2022 at 11:02:20AM +0100, Phil Thompson wrote:
> On 12/07/2022 17:55, Matic Kukovec wrote:
> > Hi Phil,
> >
> > In Qt5 there were QAction::menu/QAction::setMenu methods for setting a
> > menu on an action,
> > but in Qt6 these are templates. Could there be a workaround for this in
> > PyQt6?
> > PySide seems to have done it:
> > https://bugreports.qt.io/browse/PYSIDE-1627
>
> This comes up from time to time but not with any sense of urgency which
> suggests to me that there is another way of doing things - particularly as
> those methods were deprecated in Qt v6.0.
For actions in a menu, one can simply use a nested QMenu and addMenu method.
For actions in a toolbar, one can use QToolButton which has setMenu method
(working in PyQt6).
--
Dmitry Shachnev
More information about the PyQt
mailing list