<div class="xam_msg_class">
<div style="font: normal undefined undefined; color:undefined;">Thanks Pete,<div>It was exactly what I was looking for.. Thanks</div><div><div> </div><div>This is the code that I'm using now .. </div><div>    def contextMenuEvent(self, event) :</div><div>        qle=QtGui.QLineEdit()</div><div>        menu =QtGui.QMenu();</div><div>        wac=QtGui.QWidgetAction(menu)</div><div>        wac.setDefaultWidget(qle)</div><div>        action=menu.addAction(        wac);</div><div>        menu.exec_(event.screenPos())</div><div>        del(menu)</div><div><br></div>regards,</div><div>Matteo<br>
<div> </div><div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">From</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: pyqt-bounces@riverbankcomputing.com</span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">To</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: pyqt@riverbankcomputing.com</span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Cc</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: </span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Date</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: Mon, 13 Sep 2010 21:04:39 +0200</span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Subject</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: Re: [PyQt] Add custom widget to the QMenu</span></div>
<br>
<div>> On Monday 13 September 2010, 20:46:15 matteo.boscolo@boscolini.eu wrote:</div><div>> > Hi all, What I'm trying to do is to have at the right click on</div><div>> > a QGraphicsItem, a QLineEdit . I'm trying to use the following codedef</div><div>> > contextMenuEvent(self, event) :        #qle=QtGui.QLineEdit()            </div><div>> >    menu =QtGui.QMenu();        action=menu.addAction("test");      </div><div>> >  menu.exec_(event.screenPos())        #menu.addWidget(qle)      </div><div>> >  del(menu) But I do not know how to add the QLineEdit into the QMenu</div><div>> > .there is any way to add a custom widget to the QMenu ? Or there is any</div><div>> > other way to do such a think ? Regards,Matteo          </div><div>> </div><div>> I'm sorry for the mess, but you should have refrained from sending a html </div><div>> mail in the first place... It's always a PITA in mailing lists.</div><div>> </div><div>> Check out the QWidgetAction class.</div><div>> </div><div>> Pete</div><div>> _______________________________________________</div><div>> PyQt mailing list    PyQt@riverbankcomputing.com</div><div>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt</div></div></div>
</div>