MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / itemChange

Method itemChange

SLiCAP/schematic/component_item.py:739–756  ·  view source on GitHub ↗
(self, change, value)

Source from the content-addressed store, hash-verified

737 super().mousePressEvent(event)
738
739 def itemChange(self, change, value):
740 if change == QGraphicsItem.ItemSelectedHasChanged and not value:
741 self._active_label_key = None # deselected → forget focused label
742 if change == QGraphicsItem.ItemPositionChange and self.scene():
743 # Save old position here — self.pos() is still the old value at this point.
744 self._prev_pos = self.pos()
745 return snap(value)
746 if change == QGraphicsItem.ItemPositionHasChanged and self.scene():
747 if (self._prev_pos is not None
748 and not getattr(self.scene(), '_group_drag_active', False)):
749 delta = self.pos() - self._prev_pos
750 if delta.x() or delta.y():
751 self._rubber_band_wires(delta)
752 if change == QGraphicsItem.ItemRotationHasChanged:
753 ct = _counter_transform(self.rotation(), self.h_flip, self.v_flip)
754 for lbl in self._labels.values():
755 lbl.setTransform(ct)
756 return super().itemChange(change, value)
757
758 def _rubber_band_wires(self, delta: QPointF) -> None:
759 """Stretch the wires attached to this component's pins so they follow it.

Callers 1

itemChangeMethod · 0.45

Calls 3

_rubber_band_wiresMethod · 0.95
snapFunction · 0.85
_counter_transformFunction · 0.85

Tested by

no test coverage detected