┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2013-09-05 17:03:04 +0200
committerEmmanuel Pescosta <[email protected]>2013-09-05 17:03:04 +0200
commit1848854c6dc909ba9eea58de41112a5b444a27cf (patch)
treebe5a81dc8419f39e2cac901cca20a124b711b319 /src/kitemviews
parent7b862465d4f986b5e529cf82be892590ebf6955c (diff)
Nothing special, just a little bit of code cleanup in KItemListViewLayouter::doLayout().
Make use of QSizeF::transpose() and simplify the m_itemInfos usage. REVIEW: 112535
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/private/kitemlistviewlayouter.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/kitemviews/private/kitemlistviewlayouter.cpp b/src/kitemviews/private/kitemlistviewlayouter.cpp
index da569b3dc..d6e78ae1a 100644
--- a/src/kitemviews/private/kitemlistviewlayouter.cpp
+++ b/src/kitemviews/private/kitemlistviewlayouter.cpp
@@ -375,12 +375,9 @@ void KItemListViewLayouter::doLayout()
if (horizontalScrolling) {
// Flip everything so that the layout logically can work like having
// a vertical scrolling
- itemSize.setWidth(m_itemSize.height());
- itemSize.setHeight(m_itemSize.width());
- itemMargin.setWidth(m_itemMargin.height());
- itemMargin.setHeight(m_itemMargin.width());
- size.setWidth(m_size.height());
- size.setHeight(m_size.width());
+ itemSize.transpose();
+ itemMargin.transpose();
+ size.transpose();
if (grouped) {
// In the horizontal scrolling case all groups are aligned
@@ -411,7 +408,7 @@ void KItemListViewLayouter::doLayout()
++rowCount;
}
- m_itemInfos.reserve(itemCount);
+ m_itemInfos.resize(itemCount);
qreal y = m_headerHeight + itemMargin.height();
int row = 0;
@@ -458,18 +455,10 @@ void KItemListViewLayouter::doLayout()
}
}
- const QRectF bounds(x, y, itemSize.width(), requiredItemHeight);
- if (index < m_itemInfos.count()) {
- m_itemInfos[index].rect = bounds;
- m_itemInfos[index].column = column;
- m_itemInfos[index].row = row;
- } else {
- ItemInfo itemInfo;
- itemInfo.rect = bounds;
- itemInfo.column = column;
- itemInfo.row = row;
- m_itemInfos.append(itemInfo);
- }
+ ItemInfo& itemInfo = m_itemInfos[index];
+ itemInfo.rect = QRectF(x, y, itemSize.width(), requiredItemHeight);
+ itemInfo.column = column;
+ itemInfo.row = row;
if (grouped && horizontalScrolling) {
// When grouping is enabled in the horizontal mode, the header alignment
@@ -505,10 +494,6 @@ void KItemListViewLayouter::doLayout()
y += maxItemHeight + itemMargin.height();
++row;
}
- if (m_itemInfos.count() > itemCount) {
- m_itemInfos.erase(m_itemInfos.begin() + itemCount,
- m_itemInfos.end());
- }
if (itemCount > 0) {
// Calculate the maximum y-range of the last row for m_maximumScrollOffset