mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
Merge bitcoin-core/gui#375: Emit dataChanged signal to dynamically re-sort Peers table
986bf78d7e
qt: Emit dataChanged signal to dynamically re-sort Peers table (Hennadii Stepanov) Pull request description: [By default](https://doc.qt.io/qt-5/qsortfilterproxymodel.html#details), the `PeerTableSortProxy` > dynamically re-sorts ... data whenever the original model changes. That is not the case on master (8cdf91735f
) as inecbd911538
(#164) no signals are emitted to notify about model changes. This PR uses a dedicated [`dataChanged`](https://doc.qt.io/qt-5/qabstractitemmodel.html#dataChanged) signal. Fixes #367. An alternative to #374. ACKs for top commit: jarolrod: ACK986bf78d7e
Tree-SHA512: dcb92c2f9a2c632880429e9528007db426d2ad938c64dfa1f1538c03e4b62620df52ad7daf33b582976c67b472ff76bc0dae707049f4bbbd4941232cee9ce3d4
This commit is contained in:
commit
a62fc35a15
3 changed files with 5 additions and 5 deletions
|
@ -179,5 +179,7 @@ void PeerTableModel::refresh()
|
||||||
m_peers_data.swap(new_peers_data);
|
m_peers_data.swap(new_peers_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT changed();
|
const auto top_left = index(0, 0);
|
||||||
|
const auto bottom_right = index(rowCount() - 1, columnCount() - 1);
|
||||||
|
Q_EMIT dataChanged(top_left, bottom_right);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,9 +73,6 @@ public:
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void changed();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Internal peer data structure.
|
//! Internal peer data structure.
|
||||||
QList<CNodeCombinedStats> m_peers_data{};
|
QList<CNodeCombinedStats> m_peers_data{};
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
|
#include <QAbstractItemModel>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
@ -686,7 +687,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
|
||||||
|
|
||||||
// peer table signal handling - update peer details when selecting new node
|
// peer table signal handling - update peer details when selecting new node
|
||||||
connect(ui->peerWidget->selectionModel(), &QItemSelectionModel::selectionChanged, this, &RPCConsole::updateDetailWidget);
|
connect(ui->peerWidget->selectionModel(), &QItemSelectionModel::selectionChanged, this, &RPCConsole::updateDetailWidget);
|
||||||
connect(model->getPeerTableModel(), &PeerTableModel::changed, this, &RPCConsole::updateDetailWidget);
|
connect(model->getPeerTableModel(), &QAbstractItemModel::dataChanged, [this] { updateDetailWidget(); });
|
||||||
|
|
||||||
// set up ban table
|
// set up ban table
|
||||||
ui->banlistWidget->setModel(model->getBanTableModel());
|
ui->banlistWidget->setModel(model->getBanTableModel());
|
||||||
|
|
Loading…
Add table
Reference in a new issue