QAIV: speed up isRowHidden for the case where no rows are hidden.
isPersistent(index) is a linear search, which we can avoid altogether (as well as the creation of a persistent model index, is idx is indeed persistent) when the row-hiding feature isn't used at all. Change-Id: I07488dddf56e299806cc29749e633da00115fc30 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
This commit is contained in:
parent
97f119af14
commit
cd824ee791
@ -210,6 +210,8 @@ public:
|
||||
QSet<QPersistentModelIndex> hiddenIndexes;
|
||||
|
||||
inline bool isRowHidden(const QModelIndex &idx) const {
|
||||
if (hiddenIndexes.isEmpty())
|
||||
return false;
|
||||
//We first check if the idx is a QPersistentModelIndex, because creating QPersistentModelIndex is slow
|
||||
return isPersistent(idx) && hiddenIndexes.contains(idx);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user