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

Method boundingRect

SLiCAP/schematic/wire_item.py:158–173  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

156 # ── bounding rect ─────────────────────────────────────────────────────────
157
158 def boundingRect(self) -> QRectF:
159 br = super().boundingRect()
160 m = HANDLE_SIZE / 2.0
161 br = br.adjusted(-m, -m, m, m)
162 if self._net_label is not None and self._net_label.isVisible() and self.points:
163 br = br.united(self._net_label.mapRectToParent(self._net_label.boundingRect()))
164 anchor = self.points[0]
165 lbl_pos = self._net_label.pos()
166 m = 3.0
167 br = br.united(QRectF(
168 min(anchor.x(), lbl_pos.x()) - m,
169 min(anchor.y(), lbl_pos.y()) - m,
170 abs(anchor.x() - lbl_pos.x()) + 2 * m,
171 abs(anchor.y() - lbl_pos.y()) + 2 * m,
172 ))
173 return br
174
175 # ── hit testing ───────────────────────────────────────────────────────────
176

Callers 3

shapeMethod · 0.45
paintMethod · 0.45
_rb_keep_itemFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected