From d99d5fbea76a79346761c0d8ce98a0719e5790d2 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 27 Aug 2011 20:12:03 +0200 Subject: Improve the autoscrolling for the rubberband selection This modifications will also allow to do an autoscrolling in an easy way for drag and drop operations (not fully implemented yet). --- src/kitemviews/kitemlistcontainer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/kitemviews/kitemlistcontainer.cpp') diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index ec759bdb3..0d2637da6 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -120,7 +120,14 @@ void KItemListContainer::scrollContentsBy(int dx, int dy) return; } + const QScrollBar* scrollBar = (view->scrollOrientation() == Qt::Vertical) + ? verticalScrollBar() : horizontalScrollBar(); const qreal currentOffset = view->offset(); + if (static_cast(currentOffset) == scrollBar->value()) { + // The current offset is already synchronous to the scrollbar + return; + } + qreal offsetDiff = (view->scrollOrientation() == Qt::Vertical) ? dy : dx; const bool animRunning = (m_smoothScrollingAnimation->state() == QAbstractAnimation::Running); -- cgit v1.3