[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: PyQt6: Missing QAction.setMenu or equivalent
From: RoadrunnerWMC <roadrunnerwmc () gmail ! com>
Date: 2021-04-21 19:51:59
Message-ID: CADLpnNvGEwV7H_XtV+gH5FzM_AOwP5KXRrgJ_5FnR5ATErywQg () mail ! gmail ! com
[Download RAW message or body]
Nice idea; that does work in PyQt6. Thanks.
On Wed, Apr 21, 2021 at 2:47 PM Dmitry Shachnev <mitya57@ubuntu.com> wrote:
> On Wed, Apr 21, 2021 at 02:26:59PM -0400, RoadrunnerWMC wrote:
> > That'd work in that particular case, but it's still a problem that
> there's
> > (as far as I know) no way to implement the following common pattern in
> > PyQt6:
> >
> > recent_menu = QtWidgets.QMenu()
> > recent_menu.addAction('foo.py')
> > recent_menu.addAction('bar.txt')
> > recent_menu.addAction('baz.png')
> >
> > menu = main_window.menuBar().addMenu('&File')
> > menu.addAction('Open...')
> > menu.addAction('Open Recent').setMenu(recent_menu)
>
> I think you can use:
>
> recent_menu = QtWidgets.QMenu('Open Recent')
>
> and then simply:
>
> menu.addMenu(recent_menu)
>
> --
> Dmitry Shachnev
>
[Attachment #3 (text/html)]
<div dir="ltr">Nice idea; that does work in PyQt6. Thanks.</div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 21, 2021 at 2:47 PM \
Dmitry Shachnev <<a href="mailto:mitya57@ubuntu.com">mitya57@ubuntu.com</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Apr 21, 2021 \
at 02:26:59PM -0400, RoadrunnerWMC wrote:<br> > That'd work in that particular \
case, but it's still a problem that there's<br> > (as far as I know) no \
way to implement the following common pattern in<br> > PyQt6:<br>
><br>
> recent_menu = QtWidgets.QMenu()<br>
> recent_menu.addAction('foo.py')<br>
> recent_menu.addAction('bar.txt')<br>
> recent_menu.addAction('baz.png')<br>
><br>
> menu = main_window.menuBar().addMenu('&File')<br>
> menu.addAction('Open...')<br>
> menu.addAction('Open Recent').setMenu(recent_menu)<br>
<br>
I think you can use:<br>
<br>
recent_menu = QtWidgets.QMenu('Open Recent')<br>
<br>
and then simply:<br>
<br>
menu.addMenu(recent_menu)<br>
<br>
--<br>
Dmitry Shachnev<br>
</blockquote></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic