mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Merge bitcoin-core/gui#161: Add PeerTableModel::StatsRole to prevent data layer violation
b3e9bcaac8qt, refactor: Drop no longer used PeerTableModel::getNodeStats function (Hennadii Stepanov)49c604077cqt: Use PeerTableModel::StatsRole (Hennadii Stepanov)35007edf9cqt: 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-ACKb3e9bcaac8per `git range-diffae8f7974c05fe0 b3e9bca` promag: Code review ACKb3e9bcaac8. jonasschnelli: utACKb3e9bcaac8Tree-SHA512: 6ba50d5dd2c0373655d491ce8b130c47d598da2db5ff4b00633f447404c7e70f8562ead53ddf166e851384d9632ff9146a770c99845c2cdd3ff7250677e4c130
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user