]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistcontainer.cpp
Improve the autoscrolling for the rubberband selection
[dolphin.git] / src / kitemviews / kitemlistcontainer.cpp
index ec759bdb32a26bcddb39c3b11c4c5b3e81789ed9..0d2637da633f658add93bf54c9e092dcf53ca6f2 100644 (file)
@@ -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);