(self, event)
| 60 | self._height = 0 |
| 61 | |
| 62 | def paintEvent(self, event): |
| 63 | self._initAnimate() |
| 64 | painter = QStylePainter(self) |
| 65 | painter.setRenderHint(QPainter.Antialiasing, True) |
| 66 | painter.setRenderHint(QPainter.HighQualityAntialiasing, True) |
| 67 | painter.setRenderHint(QPainter.SmoothPixmapTransform, True) |
| 68 | painter.setBrush(QColor(self._bgcolor)) |
| 69 | painter.setPen(QColor(self._bgcolor)) |
| 70 | painter.drawEllipse( |
| 71 | QRectF( |
| 72 | (self.minimumWidth() - self._width) / 2, |
| 73 | (self.minimumHeight() - self._height) / 2, |
| 74 | self._width, |
| 75 | self._height, |
| 76 | ) |
| 77 | ) |
| 78 | # 绘制本身的文字和图标 |
| 79 | options = QStyleOptionButton() |
| 80 | options.initFrom(self) |
| 81 | size = options.rect.size() |
| 82 | size.transpose() |
| 83 | options.rect.setSize(size) |
| 84 | options.features = QStyleOptionButton.Flat |
| 85 | options.text = self.text() |
| 86 | options.icon = self.icon() |
| 87 | options.iconSize = self.iconSize() |
| 88 | painter.drawControl(QStyle.CE_PushButton, options) |
| 89 | event.accept() |
| 90 | |
| 91 | def _initAnimate(self): |
| 92 | if hasattr(self, "_animate"): |
nothing calls this directly
no test coverage detected