Optimize QAbstractItemModel::sibling a bit.
QModelIndex::sibling has a simliar optimization. Change-Id: Ic0717d480ba0d46a4c0c88064bc9eda4c4ffe6f6 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>bb10
parent
d45ef22158
commit
9f821f384b
|
|
@ -172,7 +172,7 @@ public:
|
|||
virtual QModelIndex parent(const QModelIndex &child) const = 0;
|
||||
|
||||
inline QModelIndex sibling(int row, int column, const QModelIndex &idx) const
|
||||
{ return index(row, column, parent(idx)); }
|
||||
{ return (row == idx.row() && column == idx.column()) ? idx : index(row, column, parent(idx)); }
|
||||
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const = 0;
|
||||
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue