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,17 +1459,18 @@ void KItemListView::updateVisibleRolesSizes(const KItemRangeList& itemRanges)
if (itemCount == rangesItemCount) {
m_visibleRolesSizes = visibleRolesSizes(itemRanges);
// 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();
QMutableHashIterator<QByteArray, QSizeF> it (m_visibleRolesSizes);
while (it.hasNext()) {
it.next();
const QSizeF& size = it.value();
if (size.width() < minHeaderRoleWidth) {
const QSizeF newSize(minHeaderRoleWidth, size.height());
m_visibleRolesSizes.insert(it.key(), newSize);
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();
QMutableHashIterator<QByteArray, QSizeF> it (m_visibleRolesSizes);
while (it.hasNext()) {
it.next();
const QSizeF& size = it.value();
if (size.width() < minHeaderRoleWidth) {
const QSizeF newSize(minHeaderRoleWidth, size.height());
m_visibleRolesSizes.insert(it.key(), newSize);
}
}
}
} else {

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);