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:
parent
54ceb8a5f8
commit
20e2861073
@ -3618,7 +3618,7 @@ QModelIndex QAbstractTableModel::sibling(int row, int column, const QModelIndex
|
|||||||
|
|
||||||
bool QAbstractTableModel::hasChildren(const QModelIndex &parent) const
|
bool QAbstractTableModel::hasChildren(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if (parent.model() == this || !parent.isValid())
|
if (!parent.isValid())
|
||||||
return rowCount(parent) > 0 && columnCount(parent) > 0;
|
return rowCount(parent) > 0 && columnCount(parent) > 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user