Contextmenu in a QTreeWidget with PyQT

B

blaven

I apologize in advance if this is not the correct forum to ask this
and if someone knows a better place, please let me know. But, I am
trying to create a Contextmenu (a right-click popup menu) from within
a QTreeWidget. I tried setting the contextMenuPolicy to
CustomContextMenu and then handling the signal
customContextMenuRequested() but nothing seems to be happening. ie:
self.tree = QTreeWidget()
self.tree.setContextMenuPolicy(Qt.CustomContextMenu)

self.connect(self.tree,SIGNAL('customContextMenuRequested()'),self.newContext)

Does anyone have a sample or tutorial on how to do this? One other
question, whe I right click, it changes the selection in the
TreeWidget, would I need to remove the handler for right clicks to get
the menu? Thanks!!

B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top