(svg_bytes: bytes, size: int)
| 46 | |
| 47 | |
| 48 | def _render_icon(svg_bytes: bytes, size: int) -> QIcon: |
| 49 | from PySide6.QtCore import QRectF |
| 50 | from .component_item import paint_symbol |
| 51 | pixmap = QPixmap(size, size) |
| 52 | pixmap.fill(Qt.transparent) |
| 53 | painter = QPainter(pixmap) |
| 54 | # Render through the canvas' symbol path so embedded text is centred and |
| 55 | # matches a placed component (KeepAspectRatio is handled inside paint_symbol). |
| 56 | paint_symbol(painter, svg_bytes, QRectF(0, 0, size, size)) |
| 57 | painter.end() |
| 58 | return QIcon(pixmap) |
no test coverage detected