Fix transfer list architecture

Model returns string for DisplayRole.
Text alignment is set by Model (using TextAlignmentRole).
Delegate performs custom painting only where necessary
(i.e. for Progress bar).
This commit is contained in:
Vladimir Golovnev (Glassez)
2019-12-17 21:57:36 +03:00
parent 18de63f743
commit 766cfb67df
6 changed files with 375 additions and 346 deletions

View File

@@ -35,11 +35,6 @@ class QModelIndex;
class QPainter;
class QStyleOptionViewItem;
namespace BitTorrent
{
enum class TorrentState;
}
class TransferListDelegate : public QItemDelegate
{
Q_OBJECT
@@ -49,9 +44,6 @@ public:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QWidget *createEditor(QWidget *, const QStyleOptionViewItem &, const QModelIndex &) const override;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
private:
QString getStatusString(const BitTorrent::TorrentState state) const;
};
#endif // TRANSFERLISTDELEGATE_H