鼠标进入事件
(self, _)
| 71 | super(RotateButton, self).paintEvent(event) |
| 72 | |
| 73 | def enterEvent(self, _): |
| 74 | """鼠标进入事件""" |
| 75 | # 设置阴影 |
| 76 | # 边框阴影效果 |
| 77 | effect = QGraphicsDropShadowEffect(self) |
| 78 | effect.setBlurRadius(self._padding * 2) |
| 79 | effect.setOffset(0, 0) |
| 80 | effect.setColor(self._shadowColor) |
| 81 | self.setGraphicsEffect(effect) |
| 82 | |
| 83 | # 开启旋转动画 |
| 84 | self._animation.stop() |
| 85 | cv = self._animation.currentValue() or self.STARTVALUE |
| 86 | self._animation.setDuration(self.DURATION if cv == |
| 87 | 0 else int(cv / self.ENDVALUE * |
| 88 | self.DURATION)) |
| 89 | self._animation.setStartValue(cv) |
| 90 | self._animation.setEndValue(self.ENDVALUE) |
| 91 | self._animation.start() |
| 92 | |
| 93 | def leaveEvent(self, _): |
| 94 | """鼠标离开事件""" |