mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
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
This commit is contained in:
parent
77fd0e771a
commit
76ae282ad9
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue