diff options
| author | Frank Reininghaus <[email protected]> | 2013-10-16 23:01:54 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-10-16 23:02:06 +0200 |
| commit | 76ae282ad9ad4ff9db0b7566df3c6058b38e64e6 (patch) | |
| tree | fe9080a1a3c9bc4267a58e738bc26765b9086cd7 | |
| parent | 77fd0e771ac2e173438c98abc1725d1818b4b868 (diff) | |
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
| -rw-r--r-- | src/kitemviews/private/kitemlistviewlayouter.cpp | 18 |
1 files changed, 1 insertions, 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; |
