From e907306b4118c596751bbb85ced21cd9dce51c7d Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Wed, 26 Nov 2014 14:36:27 +0200 Subject: [PATCH] Right align header text that also has right-aligned row text. Closes #2188. --- src/qtlibtorrent/torrentmodel.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/qtlibtorrent/torrentmodel.cpp b/src/qtlibtorrent/torrentmodel.cpp index 71a60f63c..85623bead 100644 --- a/src/qtlibtorrent/torrentmodel.cpp +++ b/src/qtlibtorrent/torrentmodel.cpp @@ -383,6 +383,30 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation, return QVariant(); } } + else if (role == Qt::TextAlignmentRole) { + switch(section) { + case TorrentModelItem::TR_AMOUNT_DOWNLOADED: + case TorrentModelItem::TR_AMOUNT_UPLOADED: + case TorrentModelItem::TR_AMOUNT_LEFT: + case TorrentModelItem::TR_COMPLETED: + case TorrentModelItem::TR_SIZE: + case TorrentModelItem::TR_TOTAL_SIZE: + case TorrentModelItem::TR_ETA: + case TorrentModelItem::TR_SEEDS: + case TorrentModelItem::TR_PEERS: + case TorrentModelItem::TR_UPSPEED: + case TorrentModelItem::TR_DLSPEED: + case TorrentModelItem::TR_UPLIMIT: + case TorrentModelItem::TR_DLLIMIT: + case TorrentModelItem::TR_RATIO_LIMIT: + case TorrentModelItem::TR_RATIO: + case TorrentModelItem::TR_PRIORITY: + case TorrentModelItem::TR_LAST_ACTIVITY: + return Qt::AlignRight; + default: + return QAbstractListModel::headerData(section, orientation, role); + } + } } return QVariant();