From dbc5fd7a491f95ca4084a113d0f902ea975478fd Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Wed, 22 Feb 2012 18:28:11 +0100 Subject: Fix alternate backgrounds when enabling grouping Up to now the alternating backgrounds just have been calculated by checking whether the item index is odd. This does not work well when grouping is enabled: In this case the alternate background color of the first item of a group should stay consistent. --- src/kitemviews/kfileitemlistview.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'src/kitemviews/kfileitemlistview.cpp') diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp index 25f7738bf..27ef7fdb5 100644 --- a/src/kitemviews/kfileitemlistview.cpp +++ b/src/kitemviews/kfileitemlistview.cpp @@ -324,9 +324,6 @@ void KFileItemListView::initializeItemListWidget(KItemListWidget* item) case DetailsLayout: fileItemListWidget->setLayout(KFileItemListWidget::DetailsLayout); break; default: Q_ASSERT(false); break; } - - fileItemListWidget->setAlternatingBackgroundColors(m_itemLayout == DetailsLayout && - visibleRoles().count() > 1); } bool KFileItemListView::itemSizeHintUpdateRequired(const QSet& changedRoles) const @@ -379,20 +376,9 @@ void KFileItemListView::onScrollOffsetChanged(qreal current, qreal previous) void KFileItemListView::onVisibleRolesChanged(const QList& current, const QList& previous) { + Q_UNUSED(current); + Q_UNUSED(previous); applyRolesToModel(); - - if (m_itemLayout == DetailsLayout) { - // Only enable the alternating background colors if more than one role - // is visible - const int previousCount = previous.count(); - const int currentCount = current.count(); - if ((previousCount <= 1 && currentCount > 1) || (previousCount > 1 && currentCount <= 1)) { - const bool enabled = (currentCount > 1); - foreach (KItemListWidget* widget, visibleItemListWidgets()) { - widget->setAlternatingBackgroundColors(enabled); - } - } - } } void KFileItemListView::onStyleOptionChanged(const KItemListStyleOption& current, const KItemListStyleOption& previous) -- cgit v1.3