Skip to content

Commit 195fcb5

Browse files
committed
qt: Follow Qt docs when implementing rowCount and columnCount
1 parent ae8f797 commit 195fcb5

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

src/qt/addresstablemodel.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,17 @@ AddressTableModel::~AddressTableModel()
177177

178178
int AddressTableModel::rowCount(const QModelIndex &parent) const
179179
{
180-
Q_UNUSED(parent);
180+
if (parent.isValid()) {
181+
return 0;
182+
}
181183
return priv->size();
182184
}
183185

184186
int AddressTableModel::columnCount(const QModelIndex &parent) const
185187
{
186-
Q_UNUSED(parent);
188+
if (parent.isValid()) {
189+
return 0;
190+
}
187191
return columns.length();
188192
}
189193

src/qt/bantablemodel.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,17 @@ BanTableModel::~BanTableModel()
9898

9999
int BanTableModel::rowCount(const QModelIndex &parent) const
100100
{
101-
Q_UNUSED(parent);
101+
if (parent.isValid()) {
102+
return 0;
103+
}
102104
return priv->size();
103105
}
104106

105107
int BanTableModel::columnCount(const QModelIndex &parent) const
106108
{
107-
Q_UNUSED(parent);
109+
if (parent.isValid()) {
110+
return 0;
111+
}
108112
return columns.length();
109113
}
110114

src/qt/peertablemodel.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,17 @@ void PeerTableModel::stopAutoRefresh()
134134

135135
int PeerTableModel::rowCount(const QModelIndex &parent) const
136136
{
137-
Q_UNUSED(parent);
137+
if (parent.isValid()) {
138+
return 0;
139+
}
138140
return priv->size();
139141
}
140142

141143
int PeerTableModel::columnCount(const QModelIndex &parent) const
142144
{
143-
Q_UNUSED(parent);
145+
if (parent.isValid()) {
146+
return 0;
147+
}
144148
return columns.length();
145149
}
146150

src/qt/recentrequeststablemodel.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ RecentRequestsTableModel::~RecentRequestsTableModel()
3636

3737
int RecentRequestsTableModel::rowCount(const QModelIndex &parent) const
3838
{
39-
Q_UNUSED(parent);
40-
39+
if (parent.isValid()) {
40+
return 0;
41+
}
4142
return list.length();
4243
}
4344

4445
int RecentRequestsTableModel::columnCount(const QModelIndex &parent) const
4546
{
46-
Q_UNUSED(parent);
47-
47+
if (parent.isValid()) {
48+
return 0;
49+
}
4850
return columns.length();
4951
}
5052

src/qt/transactiontablemodel.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,17 @@ void TransactionTableModel::updateConfirmations()
289289

290290
int TransactionTableModel::rowCount(const QModelIndex &parent) const
291291
{
292-
Q_UNUSED(parent);
292+
if (parent.isValid()) {
293+
return 0;
294+
}
293295
return priv->size();
294296
}
295297

296298
int TransactionTableModel::columnCount(const QModelIndex &parent) const
297299
{
298-
Q_UNUSED(parent);
300+
if (parent.isValid()) {
301+
return 0;
302+
}
299303
return columns.length();
300304
}
301305

0 commit comments

Comments
 (0)