aboutsummaryrefslogtreecommitdiff
path: root/src/qt/recentrequeststablemodel.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-01-07 14:59:08 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-01-07 14:59:15 +0100
commit4b8b71e630415647c75fa95d5407690b372bceff (patch)
tree9c20bc97e898f15efe037294986f628c931045d3 /src/qt/recentrequeststablemodel.cpp
parent42675e783337bf56dfc51df6c14931df5e72f185 (diff)
parent195fcb53a09e9b852544778a077727f81d31303e (diff)
Merge bitcoin-core/gui#173: Follow Qt docs when implementing rowCount and columnCount
195fcb53a09e9b852544778a077727f81d31303e qt: Follow Qt docs when implementing rowCount and columnCount (Hennadii Stepanov) Pull request description: [`QAbstractItemModel::rowCount`](https://doc.qt.io/qt-5/qabstractitemmodel.html#rowCount): > **Note:** When implementing a table based model, `rowCount()` should return 0 when the parent is valid. [`QAbstractItemModel::columnCount`](https://doc.qt.io/qt-5/qabstractitemmodel.html#columnCount): > **Note:** When implementing a table based model, `columnCount()` should return 0 when the parent is valid. ACKs for top commit: jarolrod: Tested ACK 195fcb53a09e9b852544778a077727f81d31303e. Compiled and ran on macOS (Big Sur 11.1 and Catalina 10.15.7), Arch Linux, and FreeBSD. visually verified no weird effects with the `Address`, `Ban`, `Peer`, and `Transaction` tables. As already stated, the code change brings us inline with what the QT Docs recommend. Tree-SHA512: 179a3430e68e77b22cdf642964cd96c023a2286ee256bbeb25b43df3d2eef6f59978c8d92173c6be5071d127fdcd6aa338142f6eaf003ff08e4abd65172d20ca
Diffstat (limited to 'src/qt/recentrequeststablemodel.cpp')
-rw-r--r--src/qt/recentrequeststablemodel.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp
index 5fa9f7cd96..18b913774b 100644
--- a/src/qt/recentrequeststablemodel.cpp
+++ b/src/qt/recentrequeststablemodel.cpp
@@ -36,15 +36,17 @@ RecentRequestsTableModel::~RecentRequestsTableModel()
int RecentRequestsTableModel::rowCount(const QModelIndex &parent) const
{
- Q_UNUSED(parent);
-
+ if (parent.isValid()) {
+ return 0;
+ }
return list.length();
}
int RecentRequestsTableModel::columnCount(const QModelIndex &parent) const
{
- Q_UNUSED(parent);
-
+ if (parent.isValid()) {
+ return 0;
+ }
return columns.length();
}