diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2021-01-11 09:06:15 +0100 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2021-01-11 09:06:21 +0100 |
commit | 616eace02acdc5f9ce775f6bf82fc8964980162f (patch) | |
tree | cc707b95499899fc8c379b17caf1b98ac75fc35f /src/qt/peertablemodel.cpp | |
parent | 9c0b76c709c1d197c4097f654de5f4e8dcef4ac6 (diff) | |
parent | b3e9bcaac85a64a1b41d534b28c8cfb1f08e14e5 (diff) | |
download | bitcoin-616eace02acdc5f9ce775f6bf82fc8964980162f.tar.xz |
Merge bitcoin-core/gui#161: Add PeerTableModel::StatsRole to prevent data layer violation
b3e9bcaac85a64a1b41d534b28c8cfb1f08e14e5 qt, refactor: Drop no longer used PeerTableModel::getNodeStats function (Hennadii Stepanov)
49c604077c572fcdea8739eb3383467dbbbc5f52 qt: Use PeerTableModel::StatsRole (Hennadii Stepanov)
35007edf9c0f592303f0cbda3ade776c87fd80b1 qt: Add PeerTableModel::StatsRole (Hennadii Stepanov)
Pull request description:
This PR allows to access to the `CNodeCombinedStats` instance directly from any view object.
The `PeerTableModel::getNodeStats` member function removed as a kind of layer violation.
No behavior changes.
Also other pulls (bugfixes) are based on this one: #18 and #164.
ACKs for top commit:
jonatack:
Tested re-ACK b3e9bcaac85a64a1b41d534b28c8cfb1f08e14e5 per `git range-diff ae8f797 4c05fe0 b3e9bca`
promag:
Code review ACK b3e9bcaac85a64a1b41d534b28c8cfb1f08e14e5.
jonasschnelli:
utACK b3e9bcaac85a64a1b41d534b28c8cfb1f08e14e5
Tree-SHA512: 6ba50d5dd2c0373655d491ce8b130c47d598da2db5ff4b00633f447404c7e70f8562ead53ddf166e851384d9632ff9146a770c99845c2cdd3ff7250677e4c130
Diffstat (limited to 'src/qt/peertablemodel.cpp')
-rw-r--r-- | src/qt/peertablemodel.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index b02e4076e2..bad81d894c 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -185,6 +185,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(); @@ -220,11 +225,6 @@ QModelIndex PeerTableModel::index(int row, int column, const QModelIndex &parent return QModelIndex(); } -const CNodeCombinedStats *PeerTableModel::getNodeStats(int idx) -{ - return priv->index(idx); -} - void PeerTableModel::refresh() { Q_EMIT layoutAboutToBeChanged(); |