0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

qt: Add PeerTableModel::StatsRole

This change allows access to CNodeCombinedStats instance directly from
any view object.
This commit is contained in:
Hennadii Stepanov 2020-12-24 12:15:57 +02:00
parent f1f26b8d5b
commit 35007edf9c
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 10 additions and 0 deletions

View file

@ -181,6 +181,11 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
default:
return QVariant();
}
} else if (role == StatsRole) {
switch (index.column()) {
case NetNodeId: return QVariant::fromValue(rec);
default: return QVariant();
}
}
return QVariant();

View file

@ -28,6 +28,7 @@ struct CNodeCombinedStats {
CNodeStateStats nodeStateStats;
bool fNodeStateStatsAvailable;
};
Q_DECLARE_METATYPE(CNodeCombinedStats*)
class NodeLessThan
{
@ -67,6 +68,10 @@ public:
Subversion = 6
};
enum {
StatsRole = Qt::UserRole,
};
/** @name Methods overridden from QAbstractTableModel
@{*/
int rowCount(const QModelIndex &parent) const override;