From: Peter Penz Date: Tue, 20 Dec 2011 22:05:20 +0000 (+0100) Subject: Fix autoscroll issue when selecting items X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/a8622c7a1ed9b04645eb5a4c72060ea5f08b5364 Fix autoscroll issue when selecting items If items get selected with the rubberband the scroll offset must stay inside the visible range. BUG: 282353 FIXED-IN: 4.8.0 --- diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 20a5f4847..42445dcfe 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -1170,7 +1170,9 @@ void KItemListView::triggerAutoScrolling() // the autoscrolling may not get skipped anymore until a new rubberband is created m_skipAutoScrollForRubberBand = false; - setScrollOffset(scrollOffset() + m_autoScrollIncrement); + const qreal maxVisibleOffset = qMax(qreal(0), maximumScrollOffset() - visibleSize); + const qreal newScrollOffset = qMin(scrollOffset() + m_autoScrollIncrement, maxVisibleOffset); + setScrollOffset(newScrollOffset); // Trigger the autoscroll timer which will periodically call // triggerAutoScrolling()