mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-25 18:56:34 +03:00
- Play with Transfer list columns alignment
This commit is contained in:
parent
9fdc6a2acd
commit
04a3fcb0ed
2 changed files with 15 additions and 2 deletions
|
@ -58,7 +58,7 @@ public:
|
|||
switch(index.column()){
|
||||
case SIZE:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
opt.displayAlignment = Qt::AlignHCenter;
|
||||
opt.displayAlignment = Qt::AlignRight;
|
||||
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong()));
|
||||
break;
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ public:
|
|||
display += " ("+QString::number((qulonglong)(tot_val%100000)/10)+")";
|
||||
}
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
opt.displayAlignment = Qt::AlignRight;
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
|
||||
break;
|
||||
}
|
||||
|
@ -109,11 +110,13 @@ public:
|
|||
case DLSPEED:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
double speed = index.data().toDouble();
|
||||
opt.displayAlignment = Qt::AlignRight;
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number(speed/1024., 'f', 1)+" "+tr("KiB/s"));
|
||||
break;
|
||||
}
|
||||
case RATIO:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
opt.displayAlignment = Qt::AlignRight;
|
||||
double ratio = index.data().toDouble();
|
||||
if(ratio > 100.)
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞"));
|
||||
|
@ -124,9 +127,11 @@ public:
|
|||
case PRIORITY: {
|
||||
int priority = index.data().toInt();
|
||||
if(priority >= 0) {
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
opt.displayAlignment = Qt::AlignRight;
|
||||
QItemDelegate::paint(painter, opt, index);
|
||||
} else {
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
opt.displayAlignment = Qt::AlignRight;
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, "*");
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -59,15 +59,23 @@ TransferListWidget::TransferListWidget(QWidget *parent, bittorrent *_BTSession):
|
|||
listModel = new QStandardItemModel(0,12);
|
||||
listModel->setHeaderData(NAME, Qt::Horizontal, tr("Name", "i.e: torrent name"));
|
||||
listModel->setHeaderData(SIZE, Qt::Horizontal, tr("Size", "i.e: torrent size"));
|
||||
listModel->horizontalHeaderItem(SIZE)->setTextAlignment(Qt::AlignRight);
|
||||
listModel->setHeaderData(PROGRESS, Qt::Horizontal, tr("Done", "% Done"));
|
||||
listModel->horizontalHeaderItem(PROGRESS)->setTextAlignment(Qt::AlignHCenter);
|
||||
listModel->setHeaderData(STATUS, Qt::Horizontal, tr("Status", "Torrent status (e.g. downloading, seeding, paused)"));
|
||||
listModel->setHeaderData(SEEDS, Qt::Horizontal, tr("Seeds", "i.e. full sources (often untranslated)"));
|
||||
listModel->horizontalHeaderItem(SEEDS)->setTextAlignment(Qt::AlignRight);
|
||||
listModel->setHeaderData(PEERS, Qt::Horizontal, tr("Peers", "i.e. partial sources (often untranslated)"));
|
||||
listModel->horizontalHeaderItem(PEERS)->setTextAlignment(Qt::AlignRight);
|
||||
listModel->setHeaderData(DLSPEED, Qt::Horizontal, tr("Down Speed", "i.e: Download speed"));
|
||||
listModel->horizontalHeaderItem(DLSPEED)->setTextAlignment(Qt::AlignRight);
|
||||
listModel->setHeaderData(UPSPEED, Qt::Horizontal, tr("Up Speed", "i.e: Upload speed"));;
|
||||
listModel->horizontalHeaderItem(UPSPEED)->setTextAlignment(Qt::AlignRight);
|
||||
listModel->setHeaderData(RATIO, Qt::Horizontal, tr("Ratio", "Share ratio"));
|
||||
listModel->horizontalHeaderItem(RATIO)->setTextAlignment(Qt::AlignRight);
|
||||
listModel->setHeaderData(ETA, Qt::Horizontal, tr("ETA", "i.e: Estimated Time of Arrival / Time left"));
|
||||
listModel->setHeaderData(PRIORITY, Qt::Horizontal, "#");
|
||||
listModel->horizontalHeaderItem(PRIORITY)->setTextAlignment(Qt::AlignRight);
|
||||
|
||||
// Set Sort/Filter proxy
|
||||
proxyModel = new QSortFilterProxyModel();
|
||||
|
|
Loading…
Reference in a new issue