Skip to content

Commit 22f298b

Browse files
committed
fixed #166
1 parent 566f75e commit 22f298b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

QProgressBar/ColourfulProgress.py

+3
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ def paintEvent(self, _):
137137
painter.setPen(QPen(color, self._lineWidth))
138138

139139
if self._animation:
140+
if self._animation.state() == QProgressStyleAnimation.Stopped:
141+
# FIXME: 最小化后动画会停止
142+
self._animation.start()
140143
step = int(self._animation.animationStep() % self._lineWidth)
141144
else:
142145
step = 0

QProgressBar/Lib/QStyleAnimation.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525

2626
class QStyleAnimation(QAbstractAnimation):
27-
2827
FrameRate = IntEnum(
2928
'FrameRate',
3029
['DefaultFps', 'SixtyFps', 'ThirtyFps', 'TwentyFps', 'FifteenFps'])
@@ -73,7 +72,7 @@ def updateTarget(self):
7372

7473
def start(self):
7574
self._skip = 0
76-
super(QStyleAnimation, self).start(QAbstractAnimation.DeleteWhenStopped)
75+
super(QStyleAnimation, self).start(QAbstractAnimation.KeepWhenStopped)
7776

7877
def isUpdateNeeded(self):
7978
return self.currentTime() > self._delay
@@ -99,7 +98,7 @@ def animationStep(self):
9998
def progressStep(self, width):
10099
step = self.animationStep()
101100
progress = (step * width / self._speed) % width
102-
if (((step * width / self._speed) % (2 * width)) >= width):
101+
if ((step * width / self._speed) % (2 * width)) >= width:
103102
progress = width - progress
104103
return progress
105104

0 commit comments

Comments
 (0)