Don't let KItemListView decide itself whether to show the header

The header should be turned on or off by the user of the
KItemListView classes.
This commit is contained in:
Peter Penz 2011-10-08 23:05:03 +02:00
parent 8d44ebc148
commit 0ebf2d1fe0
2 changed files with 17 additions and 12 deletions

View file

@ -148,7 +148,6 @@ void KItemListView::setItemSize(const QSizeF& itemSize)
m_layouter->setItemSize(itemSize);
}
}
setHeaderShown(emptySize);
m_sizeHintResolver->clearCache();
updateLayout();
@ -1460,7 +1459,7 @@ void KItemListView::updateVisibleRolesSizes(const KItemRangeList& itemRanges)
if (itemCount == rangesItemCount) {
m_visibleRolesSizes = visibleRolesSizes(itemRanges);
if (m_header) {
// Assure the the sizes are not smaller than the minimum defined by the header
// TODO: Currently only implemented for a top-aligned header
const qreal minHeaderRoleWidth = m_header->minimumRoleWidth();
@ -1473,6 +1472,7 @@ void KItemListView::updateVisibleRolesSizes(const KItemRangeList& itemRanges)
m_visibleRolesSizes.insert(it.key(), newSize);
}
}
}
} else {
// Only a sub range of the roles need to be determined.
// The chances are good that the sizes of the sub ranges

View file

@ -189,11 +189,16 @@ void DolphinItemListContainer::setItemLayout(KFileItemListView::Layout layout)
switch (layout) {
case KFileItemListView::IconsLayout:
m_fileItemListView->setScrollOrientation(Qt::Vertical);
m_fileItemListView->setHeaderShown(false);
break;
case KFileItemListView::DetailsLayout:
m_fileItemListView->setScrollOrientation(Qt::Vertical);
m_fileItemListView->setHeaderShown(true);
break;
case KFileItemListView::CompactLayout:
m_fileItemListView->setScrollOrientation(Qt::Horizontal);
m_fileItemListView->setHeaderShown(false);
break;
default:
Q_ASSERT(false);