MCPcopy
hub / github.com/PyQt5/PyQt / paintEvent

Method paintEvent

QPushButton/RubberBandButton.py:62–89  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

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"):

Callers

nothing calls this directly

Calls 6

_initAnimateMethod · 0.95
setBrushMethod · 0.80
setPenMethod · 0.80
textMethod · 0.45
iconMethod · 0.45
drawControlMethod · 0.45

Tested by

no test coverage detected