[PyQt] QContextMenuEvent on a QTreeWidgetItem
Paul Du Bois
dubois at doublefine.com
Fri Dec 17 10:09:09 GMT 2010
Well, I suppose you would start with
def contextMenuEvent(self, event):
item = self.tree_widget.itemAt(event.globalPos())
# create or fetch a QMenu that relates to your item
or you could override the event on the widget itself, if you wanted to
deal with subclassing the widget.
Caveat: I haven't tried exactly this myself, but I do create context
menus this way.
From: pyqt-bounces at riverbankcomputing.com
[mailto:pyqt-bounces at riverbankcomputing.com] On Behalf Of Christopher
Sent: Friday, December 17, 2010 1:41 AM
To: pyqt at riverbankcomputing.com
Subject: [PyQt] QContextMenuEvent on a QTreeWidgetItem
I have been using pyqt for years at many different jobs and many
different projects, however some things elude me. (I am a self-taught
noob at heart)
I have written many tutorials for the community to help spread
knowledge, but this is one of the many things I myself have never found
a good tutorial on:
I just want to make a simple right click contextual menu on a
Can anyone share a snippet showing this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt