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
This commit is contained in:
Peter Penz 2011-12-20 23:05:20 +01:00
parent d9e1db6ea4
commit e71bdb0cf6

View 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()