Optimize QAbstractTableModel::hasChildren

Valid indexes cannot have children, in a table model, so there's no
point in asking the model about it (by calling rowCount and
columnCount).

Change-Id: Ic2d7b52538a7b67acb2c35b26e69bba5956ef5af
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
David Faure 2019-04-13 15:38:15 +02:00
parent 54ceb8a5f8
commit 20e2861073

View File

@ -3618,7 +3618,7 @@ QModelIndex QAbstractTableModel::sibling(int row, int column, const QModelIndex
bool QAbstractTableModel::hasChildren(const QModelIndex &parent) const
{
if (parent.model() == this || !parent.isValid())
if (!parent.isValid())
return rowCount(parent) > 0 && columnCount(parent) > 0;
return false;
}