┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/kitemlistcontainer.cpp12
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.cpp8
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.h1
3 files changed, 21 insertions, 0 deletions
diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp
index 65250832b..ff12aee7c 100644
--- a/src/kitemviews/kitemlistcontainer.cpp
+++ b/src/kitemviews/kitemlistcontainer.cpp
@@ -291,6 +291,9 @@ void KItemListContainer::updateScrollOffsetScrollBar()
int maximum = 0;
if (view->scrollOrientation() == Qt::Vertical) {
smoothScroller = m_verticalSmoothScroller;
+ if (smoothScroller->isAnimating()) {
+ return;
+ }
scrollOffsetScrollBar = verticalScrollBar();
// Don't scroll super fast when using a wheel mouse:
@@ -311,6 +314,9 @@ void KItemListContainer::updateScrollOffsetScrollBar()
maximum = qMax(0, int(view->maximumScrollOffset() - view->size().height()));
} else {
smoothScroller = m_horizontalSmoothScroller;
+ if (smoothScroller->isAnimating()) {
+ return;
+ }
scrollOffsetScrollBar = horizontalScrollBar();
singleStep = view->itemSize().width();
pageStep = view->size().width();
@@ -347,11 +353,17 @@ void KItemListContainer::updateItemOffsetScrollBar()
int pageStep = 0;
if (view->scrollOrientation() == Qt::Vertical) {
smoothScroller = m_horizontalSmoothScroller;
+ if (smoothScroller->isAnimating()) {
+ return;
+ }
itemOffsetScrollBar = horizontalScrollBar();
singleStep = view->size().width() / 10;
pageStep = view->size().width();
} else {
smoothScroller = m_verticalSmoothScroller;
+ if (smoothScroller->isAnimating()) {
+ return;
+ }
itemOffsetScrollBar = verticalScrollBar();
singleStep = view->size().height() / 10;
pageStep = view->size().height();
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp
index fd26d198f..517f6d983 100644
--- a/src/kitemviews/private/kitemlistsmoothscroller.cpp
+++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp
@@ -214,4 +214,12 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent *event)
m_smoothScrolling = previous;
}
+bool KItemListSmoothScroller::isAnimating()
+{
+ if (m_animation) {
+ return (m_animation->state() == QAbstractAnimation::Running);
+ }
+ return false;
+}
+
#include "moc_kitemlistsmoothscroller.cpp"
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.h b/src/kitemviews/private/kitemlistsmoothscroller.h
index 32effa3d6..9cbfbc1b8 100644
--- a/src/kitemviews/private/kitemlistsmoothscroller.h
+++ b/src/kitemviews/private/kitemlistsmoothscroller.h
@@ -68,6 +68,7 @@ public:
*/
void handleWheelEvent(QWheelEvent *event);
+ bool isAnimating();
Q_SIGNALS:
/**
* Emitted when the scrolling animation has finished