[PyQt] Contextmenu in a QTreeWidget
Jake Richards
blaven at gmail.com
Tue Nov 27 14:53:13 GMT 2007
Is there a better way of creating a contextMenu (a small menu when you right
click) inside a QTreeWidget
than setting the setContextMenuPolicy? This is what I currently do:
self.treeView = QTreeWidget()
self.treeView.setContextMenuPolicy(Qt.CustomContextMenu)
self.connect(self.treeView,SIGNAL('customContextMenuRequested(QPoint)'),
self.newContext)
But, the problem I'm having is that the right click to bring up the menu,
also changes the selection.
How can I tell the tree to ignore right clicks but still bring up the
contextmenu? Oh, and as a side
question. How can I get a list of the QTreeWidgetItems that make up the
tree? I saw items() but I
didn't quite understand how to set the QMimeData type (I'm sorry, I'm a bit
new to QT :( ) Thank you!
B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20071127/07844fe4/attachment.html
More information about the PyQt
mailing list