def itemChange(self, change, value): if change == QGraphicsItem.ItemPositionChange: if hasattr(self, '_edges'): newp = value.toPointF() for e, p in self._edges: if p == 1: e.setLine(QLineF(newp, e.line().p2())) elif p == 2: e.setLine(QLineF(e.line().p1(), newp)) return QGraphicsItem.itemChange(self, change, value)
def itemChange(self, change, value): # for selection changes test against QGraphicsItem.ItemSelectedChange # intercept the change instead of the has changed to enable features. # if change == QGraphicsItem.ItemSelectedHasChanged and self.scene(): if change == QGraphicsItem.ItemSelectedChange and self.scene(): selectionGroup = self.parent.phhSelectionGroup lock = selectionGroup.parentItem().selectionLock if value == True and (lock == None or lock == selectionGroup): selectionGroup.addToGroup(self) selectionGroup.parentItem().selectionLock = selectionGroup return QGraphicsItem.itemChange(self, change, True) # end if else: return QGraphicsItem.itemChange(self, change, False) # end else self.update(self.boundingRect()) return QGraphicsItem.itemChange(self, change, value)
def itemChange(self, change, value): if change == QGraphicsItem.ItemPositionChange : point = value.toPointF() self.pos[self.node] = [point.x(), point.y()] self.scene.update() self.m_signalLinkNode.nodeItemSignal.emit (self.node, self.pos[self.node]) return QGraphicsItem.itemChange(self, change, value)
def itemChange(self, change, value): if change == QGraphicsItem.ItemPositionChange: pos = value.toPointF() scene = self.scene() if not self.changing and scene is not None: self.changing = True scene.templatePosChange.emit(pos) self.changing = False return QGraphicsItem.itemChange(self, change, value)
def itemChange(self, change, value): if change == QGraphicsItem.ItemSceneChange: # if the item is removed from the scene ... if self.scene(): if self.arrow: # I can only remove the target of the arrow ... so I have to remove the source src = self.arrow.source self.arrow.removeArrow() src.removePoint() if self.link: self.link.removePoint() if self.back_link: self.back_link.link = None self.link = self.arrow = self.back_link = None elif change == QGraphicsItem.ItemPositionHasChanged: pos = self.pos() if self.link: self.link.setPos(pos) if self.arrow: self.arrow.updateShape(self, value.toPointF()) return QGraphicsItem.itemChange(self, change, value)