From: Peter Penz Date: Mon, 5 Dec 2011 18:56:41 +0000 (+0100) Subject: Fix calculation of maximum scroll offset X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/51e18583988b6404715dd9dc57863b597d7e381d?ds=inline Fix calculation of maximum scroll offset The maximum scroll offset must be the maximum y-range of the last row, not only the maximum of the last item. Thanks to Frank Reininghaus for analysing the root-cause and for providing the initial patch! BUG: 287211 FIXED-IN: 4.8.0 --- diff --git a/src/kitemviews/kitemlistviewlayouter.cpp b/src/kitemviews/kitemlistviewlayouter.cpp index 728a67aa5..cc7333232 100644 --- a/src/kitemviews/kitemlistviewlayouter.cpp +++ b/src/kitemviews/kitemlistviewlayouter.cpp @@ -399,7 +399,16 @@ void KItemListViewLayouter::doLayout() } if (itemCount > 0) { + // Calculate the maximum y-range of the last row for m_maximumScrollOffset m_maximumScrollOffset = m_itemRects.last().bottom(); + const qreal rowY = m_itemRects.last().y(); + + int index = m_itemRects.count() - 2; + while (index >= 0 && m_itemRects.at(index).bottom() >= rowY) { + m_maximumScrollOffset = qMax(m_maximumScrollOffset, m_itemRects.at(index).bottom()); + --index; + } + m_maximumItemOffset = m_columnCount * m_columnWidth; } else { m_maximumScrollOffset = 0;