Exemple #1
0
 def itemChange(self, change, value):
     if change == QGraphicsItem.ItemPositionChange and self.scene():
         command = CommandMoveItem(self, value)
         self.scene().undoStack.push(command)
     return QGraphicsLineItem.itemChange(self, change, value)
Exemple #2
0
 def itemChange(self, change, value):
     if change == QGraphicsItem.ItemPositionChange and self.scene():
         # If the position changes then do so with an redo/undo command
         command = CommandMoveItem(self, value)
         self.scene().undoStack.push(command)
     return super().itemChange(change, value)