(self, painter: QPainter, radius: int)
| 91 | painter.restore() |
| 92 | |
| 93 | def _drawArc(self, painter: QPainter, radius: int): |
| 94 | # 绘制圆弧 |
| 95 | painter.save() |
| 96 | painter.setBrush(Qt.NoBrush) |
| 97 | # 修改画笔 |
| 98 | pen = painter.pen() |
| 99 | pen.setWidthF(self.BorderWidth) |
| 100 | pen.setCapStyle(Qt.RoundCap) |
| 101 | |
| 102 | arcLength = 360.0 / (self.MaxValue - self.MinValue) * self.Value |
| 103 | rect = QRectF(-radius, -radius, radius * 2, radius * 2) |
| 104 | |
| 105 | if not self.Clockwise: |
| 106 | # 逆时针 |
| 107 | arcLength = -arcLength |
| 108 | |
| 109 | # 绘制剩余进度圆弧 |
| 110 | if self.ShowFreeArea: |
| 111 | acolor = self.BorderColor.toRgb() |
| 112 | acolor.setAlphaF(0.2) |
| 113 | pen.setColor(acolor) |
| 114 | painter.setPen(pen) |
| 115 | painter.drawArc(rect, (0 - arcLength) * |
| 116 | 16, -(360 - arcLength) * 16) |
| 117 | |
| 118 | # 绘制当前进度圆弧 |
| 119 | pen.setColor(self.BorderColor) |
| 120 | painter.setPen(pen) |
| 121 | painter.drawArc(rect, 0, -arcLength * 16) |
| 122 | |
| 123 | # 绘制进度圆弧前面的小圆 |
| 124 | if self.ShowSmallCircle: |
| 125 | offset = radius - self.BorderWidth + 1 |
| 126 | radius = self.BorderWidth / 2 - 1 |
| 127 | painter.rotate(-90) |
| 128 | circleRect = QRectF(-radius, radius + offset, |
| 129 | radius * 2, radius * 2) |
| 130 | painter.rotate(arcLength) |
| 131 | painter.drawEllipse(circleRect) |
| 132 | |
| 133 | painter.restore() |
| 134 | |
| 135 | def _drawText(self, painter: QPainter, radius: int): |
| 136 | # 绘制文字 |
no test coverage detected