mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
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
This commit is contained in:
parent
9d6d998a51
commit
0ad86983f4
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue