[PyQt] Add custom widget to the QMenu
matteo.boscolo at boscolini.eu
matteo.boscolo at boscolini.eu
Mon Sep 13 20:58:25 BST 2010
Thanks Pete,It was exactly what I was looking for.. Thanks This is the code that I'm using now .. def contextMenuEvent(self, event) : qle=QtGui.QLineEdit() menu =QtGui.QMenu(); wac=QtGui.QWidgetAction(menu) wac.setDefaultWidget(qle) action=menu.addAction( wac); menu.exec_(event.screenPos()) del(menu)regards,Matteo
From: pyqt-bounces at riverbankcomputing.com
To: pyqt at riverbankcomputing.com
Cc:
Date: Mon, 13 Sep 2010 21:04:39 +0200
Subject: Re: [PyQt] Add custom widget to the QMenu
> On Monday 13 September 2010, 20:46:15 matteo.boscolo at boscolini.eu wrote:> > Hi all, What I'm trying to do is to have at the right click on> > a QGraphicsItem, a QLineEdit . I'm trying to use the following codedef> > contextMenuEvent(self, event) : #qle=QtGui.QLineEdit() > > menu =QtGui.QMenu(); action=menu.addAction("test"); > > menu.exec_(event.screenPos()) #menu.addWidget(qle) > > del(menu) But I do not know how to add the QLineEdit into the QMenu> > .there is any way to add a custom widget to the QMenu ? Or there is any> > other way to do such a think ? Regards,Matteo > > I'm sorry for the mess, but you should have refrained from sending a html > mail in the first place... It's always a PITA in mailing lists.> > Check out the QWidgetAction class.> > Pete> _______________________________________________> PyQt mailing list PyQt at riverbankcomputing.com> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100913/f6fff352/attachment.html>
More information about the PyQt
mailing list