]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Two small simplifications in KItemListViewLayouter
authorFrank Reininghaus <frank78ac@googlemail.com>
Wed, 16 Oct 2013 21:01:54 +0000 (23:01 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Wed, 16 Oct 2013 21:02:06 +0000 (23:02 +0200)
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

src/kitemviews/private/kitemlistviewlayouter.cpp

index d6e78ae1a6beeb08298fe510e836d0fb3c4880b4..1e972571806b3748006e6f02195d986deddeb880 100644 (file)
@@ -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;