diff options
| author | Peter Penz <[email protected]> | 2011-08-27 20:12:03 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-08-27 20:13:22 +0200 |
| commit | d99d5fbea76a79346761c0d8ce98a0719e5790d2 (patch) | |
| tree | 50b944a3adf3e4533003d91df16f3b19bb636412 /src/kitemviews/kitemlistcontainer.cpp | |
| parent | 4905667ada4ddd0aee3d2bb077e401a4262804b9 (diff) | |
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).
Diffstat (limited to 'src/kitemviews/kitemlistcontainer.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistcontainer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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<int>(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); |
