@@ -144,19 +144,20 @@ def paintEvent(self, _):
144144 self ._animation .start ()
145145
146146 # 动画斜线绘制
147- if (vertical and inverted ) or (not vertical and not inverted ):
147+ startX = int (progressBar .left () - rect .height () - self ._lineWidth )
148+ endX = int (rect .right () + self ._lineWidth )
149+
150+ if (not inverted and not vertical ) or (inverted and vertical ):
148151 lines = [
149152 QLineF (x + step , progressBar .bottom (),
150153 x + rect .height () + step , progressBar .top ())
151- for x in range (int (progressBar .left () - rect .height ()),
152- int (rect .right ()), self ._lineWidth )
154+ for x in range (startX , endX , self ._lineWidth )
153155 ]
154156 else :
155157 lines = [
156- QLineF (x - step , progressBar .top (),
157- x + rect .height () - step , progressBar .bottom ())
158- for x in range (int (progressBar .left () - rect .height ()),
159- int (rect .right ()), self ._lineWidth )
158+ QLineF (x - step , progressBar .bottom (),
159+ x + rect .height () - step , progressBar .top ())
160+ for x in range (startX , endX , self ._lineWidth )
160161 ]
161162 painter .drawLines (lines )
162163
0 commit comments