Skip to content
  • David Hurka's avatar
    Fix scrolling with scrollbar when the slider is not clicked · 17c26699
    David Hurka authored
    This fixes scrolling with the scrollbar,
    so it is not reset when scrolling on the viewport afterwards.
    
    PageView’s QSroller was not correctly updated by update_scroller,
    because it was connected to QAbstractSlider::sliderMoved and sliderReleased,
    which are only emitted while the “slider is down”,
    i. e. not when the user scrolls the scrollbar other than dragging the slider.
    Now update_scroller is connected to actionTriggered(),
    which is emitted for all user interactions.
    
    Note that scrolling using the scrollbar calls QAbstractScrollArea::scrollContentsBy(),
    and so bypasses smooth scrolling of the QScroller. This could be considered a feature,
    otherwise it is more a bug in Qt than in Okular, because we can not ignore scrollContentsBy().
    
    Steps to reproduce:
    1. Open a long document
    2. Click on the vertical scrollbar below the slider
    3. Okular scrolls one page down
    4. Scroll in the viewport
    5. Okular starts scrolling from the position from step 1.
    
    Test plan:
    * Scroll using scrollbar
      + Click on the vertical scrollbar below the slider
      + Middle-click on the vertical scrollbar below the slider
      + Click on the little arrow of the vertical scrollbar
      + Scroll using a scrolling device (e. g. `xdotool click 4`) on the vertical scrollbar
      + Drag the slider of the scrollbar
    * “cross-product” verify QScroller state
      + Scroll using a scrolling device on the viewport
      + Scroll using Browse tool dragging
      + Scroll the viewport by clicking a point in the thumbnails view
      + Scroll the viewport using arrow keys and Page Up/Down keys
    
    BUG: 421159
    17c26699