From a16c557137cbf73a2053ef4b78577fd488846d45 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 8 Mar 2017 13:10:45 +0800 Subject: [PATCH] Always draw background --- src/gui/properties/proplistdelegate.cpp | 8 +------- src/gui/search/searchlistdelegate.cpp | 8 ++------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/gui/properties/proplistdelegate.cpp b/src/gui/properties/proplistdelegate.cpp index 607e0f522..d8ab3aff8 100644 --- a/src/gui/properties/proplistdelegate.cpp +++ b/src/gui/properties/proplistdelegate.cpp @@ -72,14 +72,13 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti { painter->save(); QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option); + QItemDelegate::drawBackground(painter, opt, index); switch(index.column()) { case PCSIZE: - QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(index.data().toLongLong())); break; case REMAINING: - QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(index.data().toLongLong())); break; case PROGRESS: @@ -106,13 +105,8 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti st.drawControl(QStyle::CE_ProgressBar, &newopt, painter, 0); #endif } - else { - // Do not display anything if the file is disabled (progress == 0) - QItemDelegate::drawBackground(painter, opt, index); - } break; case PRIORITY: { - QItemDelegate::drawBackground(painter, opt, index); QString text = ""; switch (index.data().toInt()) { case prio::MIXED: diff --git a/src/gui/search/searchlistdelegate.cpp b/src/gui/search/searchlistdelegate.cpp index dc286f5d9..233133c1f 100644 --- a/src/gui/search/searchlistdelegate.cpp +++ b/src/gui/search/searchlistdelegate.cpp @@ -47,19 +47,15 @@ void SearchListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op painter->save(); QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option); + QItemDelegate::drawBackground(painter, opt, index); + switch(index.column()) { case SearchSortModel::SIZE: - QItemDelegate::drawBackground(painter, opt, index); opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(index.data().toLongLong())); break; case SearchSortModel::SEEDS: - QItemDelegate::drawBackground(painter, opt, index); - opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; - QItemDelegate::drawDisplay(painter, opt, option.rect, (index.data().toLongLong() >= 0) ? index.data().toString() : tr("Unknown")); - break; case SearchSortModel::LEECHES: - QItemDelegate::drawBackground(painter, opt, index); opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; QItemDelegate::drawDisplay(painter, opt, option.rect, (index.data().toLongLong() >= 0) ? index.data().toString() : tr("Unknown")); break;