Allow transfer list text color changes through QSS

This commit is contained in:
Prince Gupta
2019-12-16 22:15:08 +05:30
parent d09c5e529c
commit d3aa45526a
6 changed files with 299 additions and 1 deletions

View File

@@ -31,12 +31,14 @@
#define TRANSFERLISTMODEL_H
#include <QAbstractListModel>
#include <QColor>
#include <QList>
namespace BitTorrent
{
class InfoHash;
class TorrentHandle;
enum class TorrentState;
}
class TransferListModel : public QAbstractListModel
@@ -93,6 +95,9 @@ public:
BitTorrent::TorrentHandle *torrentHandle(const QModelIndex &index) const;
void setStateForeground(BitTorrent::TorrentState state, const QColor& color);
QColor stateForeground(BitTorrent::TorrentState state) const;
private slots:
void addTorrent(BitTorrent::TorrentHandle *const torrent);
void handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent);
@@ -102,6 +107,9 @@ private slots:
private:
QList<BitTorrent::TorrentHandle *> m_torrentList; // maps row number to torrent handle
QHash<BitTorrent::TorrentHandle *, int> m_torrentMap; // maps torrent handle to row number
// row text colors
QHash<BitTorrent::TorrentState, QColor> m_stateForegroundColors;
};
#endif // TRANSFERLISTMODEL_H