Merge bitcoin-core/gui#173: Follow Qt docs when implementing rowCount and columnCount
195fcb53a0qt: 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 ACK195fcb53a0. 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
This commit is contained in:
5 files changed
+30
-12
No files matched your search
@@ -177,13 +177,17 @@ AddressTableModel::~AddressTableModel()
|
|||||||
|
|
||||||
int AddressTableModel::rowCount(const QModelIndex &parent) const
|
int AddressTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return priv->size();
|
return priv->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AddressTableModel::columnCount(const QModelIndex &parent) const
|
int AddressTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return columns.length();
|
return columns.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,13 +98,17 @@ BanTableModel::~BanTableModel()
|
|||||||
|
|
||||||
int BanTableModel::rowCount(const QModelIndex &parent) const
|
int BanTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return priv->size();
|
return priv->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int BanTableModel::columnCount(const QModelIndex &parent) const
|
int BanTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return columns.length();
|
return columns.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,13 +134,17 @@ void PeerTableModel::stopAutoRefresh()
|
|||||||
|
|
||||||
int PeerTableModel::rowCount(const QModelIndex &parent) const
|
int PeerTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return priv->size();
|
return priv->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int PeerTableModel::columnCount(const QModelIndex &parent) const
|
int PeerTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return columns.length();
|
return columns.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,15 +36,17 @@ RecentRequestsTableModel::~RecentRequestsTableModel()
|
|||||||
|
|
||||||
int RecentRequestsTableModel::rowCount(const QModelIndex &parent) const
|
int RecentRequestsTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return list.length();
|
return list.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
int RecentRequestsTableModel::columnCount(const QModelIndex &parent) const
|
int RecentRequestsTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return columns.length();
|
return columns.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -289,13 +289,17 @@ void TransactionTableModel::updateConfirmations()
|
|||||||
|
|
||||||
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return priv->size();
|
return priv->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int TransactionTableModel::columnCount(const QModelIndex &parent) const
|
int TransactionTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return columns.length();
|
return columns.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user