Generate a pixmap for the requested size, mode, and state.
(self, size, mode, state)
| 706 | painter.drawPixmap(rect, pixmap) |
| 707 | |
| 708 | def pixmap(self, size, mode, state): |
| 709 | """Generate a pixmap for the requested size, mode, and state.""" |
| 710 | if size.width() <= 0 or size.height() <= 0: |
| 711 | return QtGui.QPixmap() |
| 712 | |
| 713 | # Try SVG first, then fall back to PNG |
| 714 | svg_path = self.image_path.with_suffix('.svg') |
| 715 | if svg_path.exists(): |
| 716 | pixmap = self._create_pixmap_from_svg(svg_path, size) |
| 717 | if not pixmap.isNull(): |
| 718 | return pixmap |
| 719 | return self._create_pixmap_from_png(self.image_path, size) |
| 720 | |
| 721 | def _devicePixelRatio(self): |
| 722 | """Return the current device pixel ratio for the toolbar, defaulting to 1.""" |
no test coverage detected