Well, I suppose you would start with
class MainWindow(QMainWindow): def contextMenuEvent(self, event): item = self.tree_widget.itemAt(event.globalPos()) # create or fetch a QMenu that relates to your item menu.exec(event.globalPos()) 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. p From: pyqt-boun...@riverbankcomputing.com [mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Christopher Evans Sent: Friday, December 17, 2010 1:41 AM To: pyqt@riverbankcomputing.com Subject: [PyQt] QContextMenuEvent on a QTreeWidgetItem Hi guys, 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 treewidgetitem. Can anyone share a snippet showing this? Thanks! -- CE
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt