PyQt4
I am sub classing QGraphicsView & QGraphicsItem.
I do have a contextMenuEvent in both of them. How ever while right clicking on item creates the menu of view. It's not creating the menu defined in item.
If I disable the menu of view, item's menu is working fine.
How do I ignore this clashing?
Here is code of Item's contextMenuEvent
def contextMenuEvent(self, event):
menu.addAction("Copy")
menu.addAction("Paste")
menu.exec_(event.screenPos())
def contextMenuEvent(self, event):
menu = QtGui.QMenu()
menu.addAction("Copy")
menu.addAction("Paste")
menu.exec_(event.screenPos())
To copy to clipboard, switch view to plain text mode
Code of view's contextMenuEvent
menu = .....
.....
menu.exec_(event.globalPos())
menu = .....
.....
menu.exec_(event.globalPos())
To copy to clipboard, switch view to plain text mode
Bookmarks