prashant
9th October 2009, 05:35
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 = QtGui.QMenu()
menu.addAction("Copy")
menu.addAction("Paste")
menu.exec_(event.screenPos())
Code of view's contextMenuEvent
menu = .....
.....
menu.exec_(event.globalPos())
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 = QtGui.QMenu()
menu.addAction("Copy")
menu.addAction("Paste")
menu.exec_(event.screenPos())
Code of view's contextMenuEvent
menu = .....
.....
menu.exec_(event.globalPos())