Skip to content

Commit 35007ed

Browse files
committed
qt: Add PeerTableModel::StatsRole
This change allows access to CNodeCombinedStats instance directly from any view object.
1 parent f1f26b8 commit 35007ed

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/qt/peertablemodel.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
181181
default:
182182
return QVariant();
183183
}
184+
} else if (role == StatsRole) {
185+
switch (index.column()) {
186+
case NetNodeId: return QVariant::fromValue(rec);
187+
default: return QVariant();
188+
}
184189
}
185190

186191
return QVariant();

src/qt/peertablemodel.h

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct CNodeCombinedStats {
2828
CNodeStateStats nodeStateStats;
2929
bool fNodeStateStatsAvailable;
3030
};
31+
Q_DECLARE_METATYPE(CNodeCombinedStats*)
3132

3233
class NodeLessThan
3334
{
@@ -67,6 +68,10 @@ class PeerTableModel : public QAbstractTableModel
6768
Subversion = 6
6869
};
6970

71+
enum {
72+
StatsRole = Qt::UserRole,
73+
};
74+
7075
/** @name Methods overridden from QAbstractTableModel
7176
@{*/
7277
int rowCount(const QModelIndex &parent) const override;

0 commit comments

Comments
 (0)