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

Method enterEvent

QPushButton/RotateButton.py:92–110  ·  view source on GitHub ↗

鼠标进入事件

(self, _)

Source from the content-addressed store, hash-verified

90 super(RotateButton, self).paintEvent(event)
91
92 def enterEvent(self, _):
93 """鼠标进入事件"""
94 # 设置阴影
95 # 边框阴影效果
96 effect = QGraphicsDropShadowEffect(self)
97 effect.setBlurRadius(self._padding * 2)
98 effect.setOffset(0, 0)
99 effect.setColor(self._shadowColor)
100 self.setGraphicsEffect(effect)
101
102 # 开启旋转动画
103 self._animation.stop()
104 cv = self._animation.currentValue() or self.STARTVALUE
105 self._animation.setDuration(
106 self.DURATION if cv == 0 else int(cv / self.ENDVALUE * self.DURATION)
107 )
108 self._animation.setStartValue(cv)
109 self._animation.setEndValue(self.ENDVALUE)
110 self._animation.start()
111
112 def leaveEvent(self, _):
113 """鼠标离开事件"""

Callers

nothing calls this directly

Calls 4

setColorMethod · 0.80
setDurationMethod · 0.80
stopMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected