Don't copy the context menu of ViewBoxes.
This allows customization of the context menu of a ViewBox simply by calling viewbox.menu.addAction(...). See issue #13. Also some cleanup.
This commit is contained in:
parent
1e82104986
commit
2e61be739f
@ -1056,23 +1056,12 @@ class ViewBox(GraphicsWidget):
|
|||||||
self.raiseContextMenu(ev)
|
self.raiseContextMenu(ev)
|
||||||
|
|
||||||
def raiseContextMenu(self, ev):
|
def raiseContextMenu(self, ev):
|
||||||
#print "viewbox.raiseContextMenu called."
|
|
||||||
|
|
||||||
#menu = self.getMenu(ev)
|
|
||||||
menu = self.getMenu(ev)
|
menu = self.getMenu(ev)
|
||||||
self.scene().addParentContextMenus(self, menu, ev)
|
self.scene().addParentContextMenus(self, menu, ev)
|
||||||
#print "2:", [str(a.text()) for a in self.menu.actions()]
|
menu.popup(ev.screenPos().toPoint())
|
||||||
pos = ev.screenPos()
|
|
||||||
#pos2 = ev.scenePos()
|
|
||||||
#print "3:", [str(a.text()) for a in self.menu.actions()]
|
|
||||||
#self.sigActionPositionChanged.emit(pos2)
|
|
||||||
|
|
||||||
menu.popup(QtCore.QPoint(pos.x(), pos.y()))
|
|
||||||
#print "4:", [str(a.text()) for a in self.menu.actions()]
|
|
||||||
|
|
||||||
def getMenu(self, ev):
|
def getMenu(self, ev):
|
||||||
self._menuCopy = self.menu.copy() ## temporary storage to prevent menu disappearing
|
return self.menu
|
||||||
return self._menuCopy
|
|
||||||
|
|
||||||
def getContextMenus(self, event):
|
def getContextMenus(self, event):
|
||||||
if self.menuEnabled():
|
if self.menuEnabled():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user