(self, painter: QPainter, r: QRectF)
| 131 | return lines |
| 132 | |
| 133 | def _paint_text_fallback(self, painter: QPainter, r: QRectF) -> None: |
| 134 | lines = self._text_display_lines() |
| 135 | |
| 136 | if not self.params: |
| 137 | painter.drawText(r, Qt.AlignCenter, "Parameters\n(empty)") |
| 138 | return |
| 139 | |
| 140 | hdr_font = QFont(COMP_REFDES_FONT_FAMILY) |
| 141 | hdr_font.setBold(True) |
| 142 | hdr_font.setPointSizeF(COMP_LABEL_FONT_SIZE) |
| 143 | body_font = QFont(COMP_REFDES_FONT_FAMILY) |
| 144 | body_font.setPointSizeF(COMP_LABEL_FONT_SIZE) |
| 145 | |
| 146 | fm_h = QFontMetricsF(hdr_font) |
| 147 | fm_b = QFontMetricsF(body_font) |
| 148 | pad = fm_b.height() * 0.3 |
| 149 | line_h = fm_b.height() * _LINE_SPACING |
| 150 | y = r.top() + pad + fm_h.ascent() |
| 151 | |
| 152 | painter.setPen(_BORDER_COLOR) |
| 153 | painter.setFont(hdr_font) |
| 154 | painter.drawText(QPointF(r.left() + pad, y), lines[0]) |
| 155 | y += line_h |
| 156 | |
| 157 | painter.setFont(body_font) |
| 158 | for line in lines[1:]: |
| 159 | painter.drawText(QPointF(r.left() + pad, y), line) |
| 160 | y += line_h |
| 161 | |
| 162 | def itemChange(self, change, value): |
| 163 | if change == QGraphicsItem.ItemPositionChange: |
no test coverage detected