|
|
@ -47,19 +47,15 @@ void SearchListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op |
|
|
|
painter->save(); |
|
|
|
painter->save(); |
|
|
|
|
|
|
|
|
|
|
|
QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option); |
|
|
|
QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option); |
|
|
|
|
|
|
|
QItemDelegate::drawBackground(painter, opt, index); |
|
|
|
|
|
|
|
|
|
|
|
switch(index.column()) { |
|
|
|
switch(index.column()) { |
|
|
|
case SearchSortModel::SIZE: |
|
|
|
case SearchSortModel::SIZE: |
|
|
|
QItemDelegate::drawBackground(painter, opt, index); |
|
|
|
|
|
|
|
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; |
|
|
|
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; |
|
|
|
QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(index.data().toLongLong())); |
|
|
|
QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(index.data().toLongLong())); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case SearchSortModel::SEEDS: |
|
|
|
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: |
|
|
|
case SearchSortModel::LEECHES: |
|
|
|
QItemDelegate::drawBackground(painter, opt, index); |
|
|
|
|
|
|
|
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; |
|
|
|
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; |
|
|
|
QItemDelegate::drawDisplay(painter, opt, option.rect, (index.data().toLongLong() >= 0) ? index.data().toString() : tr("Unknown")); |
|
|
|
QItemDelegate::drawDisplay(painter, opt, option.rect, (index.data().toLongLong() >= 0) ? index.data().toString() : tr("Unknown")); |
|
|
|
break; |
|
|
|
break; |
|
|
|