┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2013-07-22 19:16:07 +0200
committerFrank Reininghaus <[email protected]>2013-07-22 19:16:07 +0200
commit0ad86983f4d746d2995720b895c14051556eeeee (patch)
tree411280bf99d9ab31eac0dbe3f681bad8b1bfcb95 /src
parent9d6d998a51316a5d15dc759d7d25a8331b922159 (diff)
Do not try to smooth-scroll past the end of the view
KItemListSmoothScroller::scrollTo(qreal position) did not check if 'position' is a valid value. Even if the view is scrolled to the bottom already, it tried to scroll further and activated "smooth scrolling" when the mouse wheel is used. Because it never got out of the "smooth scrolling" state then, it got confused when changing the directory, and restoring the correct scroll offset could fail. BUG: 322212 FIXED-IN: 4.11.0 REVIEW: 111557
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp
index 6987e1ce1..491461b80 100644
--- a/src/kitemviews/private/kitemlistsmoothscroller.cpp
+++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp
@@ -130,8 +130,13 @@ void KItemListSmoothScroller::scrollContentsBy(qreal distance)
void KItemListSmoothScroller::scrollTo(qreal position)
{
- m_smoothScrolling = true;
- m_scrollBar->setValue(position);
+ int newValue = position;
+ newValue = qBound(0, newValue, m_scrollBar->maximum());
+
+ if (newValue != m_scrollBar->value()) {
+ m_smoothScrolling = true;
+ m_scrollBar->setValue(newValue);
+ }
}
bool KItemListSmoothScroller::requestScrollBarUpdate(int newMaximum)