Beispiel #1
0
    def contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent):
        self.scene().clearSelection()
        self.setSelected(True)

        self._context_ypos_click = event.scenePos().y()

        self._create_menu()

        # call the context menu at the item position
        self.context_menu.exec_(event.screenPos())
 def contextMenuEvent(self, event: qt.QGraphicsSceneContextMenuEvent):
     item = self.itemAt(event.scenePos(), gui.QTransform())
     item = item if item and isinstance(item, AugmentItem) else self._selected
     if item:
         self._selected = item
         context_menu = qt.QMenu()
         context_menu.addAction(self.delete_act)
         context_menu.exec(event.screenPos())
         event.accept()
     else:
         event.ignore()