@@ -207,7 +207,7 @@ def setScrollButtonRepeatEnabled(self, isEnabled: bool):
207207 self .upButton .setAutoRepeat (isEnabled )
208208 self .downButton .setAutoRepeat (isEnabled )
209209
210- def _scrollWithAnimation (self , delta : int ):
210+ def _scrollWithAnimation (self , index : int ):
211211 """ scroll with adaptive animation """
212212 t = QTime .currentTime ()
213213 elapsed = self ._lastScrollTime .msecsTo (t )
@@ -220,17 +220,16 @@ def _scrollWithAnimation(self, delta: int):
220220 duration , easing = 250 , QEasingCurve .OutQuad
221221
222222 self .vScrollBar .setScrollAnimation (duration , easing )
223- index = self .currentIndex () + delta
224223 self .setCurrentIndex (index )
225224 self .scrollToItem (self .currentItem ())
226225
227226 def scrollDown (self ):
228227 """ scroll down an item """
229- self ._scrollWithAnimation (1 )
228+ self ._scrollWithAnimation (self . currentIndex () + 1 )
230229
231230 def scrollUp (self ):
232231 """ scroll up an item """
233- self ._scrollWithAnimation (- 1 )
232+ self ._scrollWithAnimation (self . currentIndex () - 1 )
234233
235234 def _setButtonsVisible (self , visible : bool ):
236235 """ set scroll buttons visibility """
0 commit comments