]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix calculation of maximum scroll offset
authorPeter Penz <peter.penz19@gmail.com>
Mon, 5 Dec 2011 18:56:41 +0000 (19:56 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Mon, 5 Dec 2011 19:01:11 +0000 (20:01 +0100)
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

src/kitemviews/kitemlistviewlayouter.cpp

index 728a67aa5698cd5c27da0af279eb0d0c5c41a379..cc7333232bcec44565253b63faca96a121796930 100644 (file)
@@ -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;