mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 21:21:24 -07:00
Make all columns and headers use the same text alignment in the transferlist.
This commit is contained in:
parent
6bfdf80a4d
commit
51a9a9aabb
2 changed files with 0 additions and 28 deletions
|
@ -290,27 +290,6 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation,
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (role == Qt::TextAlignmentRole) {
|
|
||||||
switch(section) {
|
|
||||||
case TorrentModelItem::TR_PRIORITY:
|
|
||||||
case TorrentModelItem::TR_SIZE:
|
|
||||||
case TorrentModelItem::TR_SEEDS:
|
|
||||||
case TorrentModelItem::TR_PEERS:
|
|
||||||
case TorrentModelItem::TR_DLSPEED:
|
|
||||||
case TorrentModelItem::TR_UPSPEED:
|
|
||||||
case TorrentModelItem::TR_RATIO:
|
|
||||||
case TorrentModelItem::TR_DLLIMIT:
|
|
||||||
case TorrentModelItem::TR_UPLIMIT:
|
|
||||||
case TorrentModelItem::TR_AMOUNT_DOWNLOADED:
|
|
||||||
case TorrentModelItem::TR_AMOUNT_UPLOADED:
|
|
||||||
case TorrentModelItem::TR_AMOUNT_LEFT:
|
|
||||||
return Qt::AlignRight;
|
|
||||||
case TorrentModelItem::TR_PROGRESS:
|
|
||||||
return Qt::AlignHCenter;
|
|
||||||
default:
|
|
||||||
return Qt::AlignLeft;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
|
@ -63,7 +63,6 @@ public:
|
||||||
case TorrentModelItem::TR_AMOUNT_LEFT:
|
case TorrentModelItem::TR_AMOUNT_LEFT:
|
||||||
case TorrentModelItem::TR_SIZE:{
|
case TorrentModelItem::TR_SIZE:{
|
||||||
QItemDelegate::drawBackground(painter, opt, index);
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
opt.displayAlignment = Qt::AlignRight;
|
|
||||||
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong()));
|
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +79,6 @@ public:
|
||||||
display += " ("+QString::number(index.data(Qt::UserRole).toLongLong())+")";
|
display += " ("+QString::number(index.data(Qt::UserRole).toLongLong())+")";
|
||||||
}
|
}
|
||||||
QItemDelegate::drawBackground(painter, opt, index);
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
opt.displayAlignment = Qt::AlignRight;
|
|
||||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +131,6 @@ public:
|
||||||
case TorrentModelItem::TR_DLSPEED:{
|
case TorrentModelItem::TR_DLSPEED:{
|
||||||
QItemDelegate::drawBackground(painter, opt, index);
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
const qulonglong speed = index.data().toULongLong();
|
const qulonglong speed = index.data().toULongLong();
|
||||||
opt.displayAlignment = Qt::AlignRight;
|
|
||||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, misc::friendlyUnit(speed)+tr("/s", "/second (.i.e per second)"));
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, misc::friendlyUnit(speed)+tr("/s", "/second (.i.e per second)"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +138,6 @@ public:
|
||||||
case TorrentModelItem::TR_DLLIMIT:{
|
case TorrentModelItem::TR_DLLIMIT:{
|
||||||
QItemDelegate::drawBackground(painter, opt, index);
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
const qlonglong limit = index.data().toLongLong();
|
const qlonglong limit = index.data().toLongLong();
|
||||||
opt.displayAlignment = Qt::AlignRight;
|
|
||||||
/* HACK because QString rounds up. Eg QString::number(0.999*100.0, 'f' ,1) == 99.9
|
/* HACK because QString rounds up. Eg QString::number(0.999*100.0, 'f' ,1) == 99.9
|
||||||
** but QString::number(0.9999*100.0, 'f' ,1) == 100.0 */
|
** but QString::number(0.9999*100.0, 'f' ,1) == 100.0 */
|
||||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, limit > 0 ? QString::number((int)((limit/1024.)*10)/10.0, 'f', 1) + " " + tr("KiB/s", "KiB/second (.i.e per second)") : QString::fromUtf8("∞"));
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, limit > 0 ? QString::number((int)((limit/1024.)*10)/10.0, 'f', 1) + " " + tr("KiB/s", "KiB/second (.i.e per second)") : QString::fromUtf8("∞"));
|
||||||
|
@ -163,7 +159,6 @@ public:
|
||||||
break;
|
break;
|
||||||
case TorrentModelItem::TR_RATIO:{
|
case TorrentModelItem::TR_RATIO:{
|
||||||
QItemDelegate::drawBackground(painter, opt, index);
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
opt.displayAlignment = Qt::AlignRight;
|
|
||||||
const qreal ratio = index.data().toDouble();
|
const qreal ratio = index.data().toDouble();
|
||||||
/* HACK because QString rounds up. Eg QString::number(0.999*100.0, 'f' ,1) == 99.9
|
/* HACK because QString rounds up. Eg QString::number(0.999*100.0, 'f' ,1) == 99.9
|
||||||
** but QString::number(0.9999*100.0, 'f' ,1) == 100.0 */
|
** but QString::number(0.9999*100.0, 'f' ,1) == 100.0 */
|
||||||
|
@ -173,11 +168,9 @@ public:
|
||||||
case TorrentModelItem::TR_PRIORITY: {
|
case TorrentModelItem::TR_PRIORITY: {
|
||||||
const int priority = index.data().toInt();
|
const int priority = index.data().toInt();
|
||||||
if (priority >= 0) {
|
if (priority >= 0) {
|
||||||
opt.displayAlignment = Qt::AlignRight;
|
|
||||||
QItemDelegate::paint(painter, opt, index);
|
QItemDelegate::paint(painter, opt, index);
|
||||||
} else {
|
} else {
|
||||||
QItemDelegate::drawBackground(painter, opt, index);
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
opt.displayAlignment = Qt::AlignRight;
|
|
||||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, "*");
|
QItemDelegate::drawDisplay(painter, opt, opt.rect, "*");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue