From 76ae282ad9ad4ff9db0b7566df3c6058b38e64e6 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Wed, 16 Oct 2013 23:01:54 +0200 Subject: [PATCH] Two small simplifications in KItemListViewLayouter 1. Remove the unneeded variable rowCount. 2. Simplify the calculation of the member m_maximumScrollOffset. We can just use the current value of "y" because this is the offset that the next row would have. REVIEW: 113233 --- .../private/kitemlistviewlayouter.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/kitemviews/private/kitemlistviewlayouter.cpp b/src/kitemviews/private/kitemlistviewlayouter.cpp index d6e78ae1a..1e9725718 100644 --- a/src/kitemviews/private/kitemlistviewlayouter.cpp +++ b/src/kitemviews/private/kitemlistviewlayouter.cpp @@ -403,11 +403,6 @@ void KItemListViewLayouter::doLayout() } } - int rowCount = itemCount / m_columnCount; - if (itemCount % m_columnCount != 0) { - ++rowCount; - } - m_itemInfos.resize(itemCount); qreal y = m_headerHeight + itemMargin.height(); @@ -496,18 +491,7 @@ void KItemListViewLayouter::doLayout() } if (itemCount > 0) { - // Calculate the maximum y-range of the last row for m_maximumScrollOffset - m_maximumScrollOffset = m_itemInfos.last().rect.bottom(); - const qreal rowY = m_itemInfos.last().rect.y(); - - int index = m_itemInfos.count() - 2; - while (index >= 0 && m_itemInfos[index].rect.bottom() >= rowY) { - m_maximumScrollOffset = qMax(m_maximumScrollOffset, m_itemInfos[index].rect.bottom()); - --index; - } - - m_maximumScrollOffset += itemMargin.height(); - + m_maximumScrollOffset = y; m_maximumItemOffset = m_columnCount * m_columnWidth; } else { m_maximumScrollOffset = 0; -- 2.47.3