]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix autoscroll issue when selecting items
authorPeter Penz <peter.penz19@gmail.com>
Tue, 20 Dec 2011 22:05:20 +0000 (23:05 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Tue, 20 Dec 2011 22:08:26 +0000 (23:08 +0100)
If items get selected with the rubberband the scroll offset must stay inside
the visible range.

BUG: 282353
FIXED-IN: 4.8.0

src/kitemviews/kitemlistview.cpp

index 20a5f4847c897f99353f9b5eed77c2a2c89e57a8..42445dcfe89951dd46e7ba08c2eee5e13e3e60c4 100644 (file)
@@ -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()