diff options
| author | Peter Penz <[email protected]> | 2012-02-22 18:28:11 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-02-22 18:31:03 +0100 |
| commit | dbc5fd7a491f95ca4084a113d0f902ea975478fd (patch) | |
| tree | f9c43d6008e48189f39bd58cd7f0982a5f177065 /src/kitemviews/kfileitemlistview.cpp | |
| parent | bdd0fdf2460232fe17b0e54e42fcda4cc18b811a (diff) | |
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.
Diffstat (limited to 'src/kitemviews/kfileitemlistview.cpp')
| -rw-r--r-- | src/kitemviews/kfileitemlistview.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
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<QByteArray>& changedRoles) const @@ -379,20 +376,9 @@ void KFileItemListView::onScrollOffsetChanged(qreal current, qreal previous) void KFileItemListView::onVisibleRolesChanged(const QList<QByteArray>& current, const QList<QByteArray>& 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) |
