diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-06-16 09:00:15 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-06-16 09:19:55 (GMT) |
commit | 4be622995ad6a46b10788f5d62ed2368cffcb3dd (patch) | |
tree | 61813a00babe49b302932ef223b1411d4c83de4c /src/gui/itemviews/qlistview_p.h | |
parent | 6100dd1ccda7fce60625e99ffb2a90dc62cb1486 (diff) | |
download | Qt-4be622995ad6a46b10788f5d62ed2368cffcb3dd.zip Qt-4be622995ad6a46b10788f5d62ed2368cffcb3dd.tar.gz Qt-4be622995ad6a46b10788f5d62ed2368cffcb3dd.tar.bz2 |
QListView: speedup QListView::setRowHidden()
Basically the same optimisation that had been made long ago in the tree view:
Use the right data structure for QListViewPrivate::hiddenRows
(QSet instead of QVector)
Task-number: QTBUG-11438
Reviewed-by: Gabriel
Diffstat (limited to 'src/gui/itemviews/qlistview_p.h')
-rw-r--r-- | src/gui/itemviews/qlistview_p.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h index 9ae1f50..1b71131 100644 --- a/src/gui/itemviews/qlistview_p.h +++ b/src/gui/itemviews/qlistview_p.h @@ -378,7 +378,10 @@ public: inline bool isSelectionRectVisible() const { return showElasticBand; } inline QModelIndex modelIndex(int row) const { return model->index(row, column, root); } - inline bool isHidden(int row) const { return hiddenRows.contains(model->index(row, 0, root)); } + inline bool isHidden(int row) const { + QModelIndex idx = model->index(row, 0, root); + return isPersistent(idx) && hiddenRows.contains(idx); + } inline bool isHiddenOrDisabled(int row) const { return isHidden(row) || !isIndexEnabled(modelIndex(row)); } inline void removeCurrentAndDisabled(QVector<QModelIndex> *indexes, const QModelIndex ¤t) const { @@ -432,7 +435,7 @@ public: QBasicTimer batchLayoutTimer; // used for hidden items - QVector<QPersistentModelIndex> hiddenRows; + QSet<QPersistentModelIndex> hiddenRows; int column; bool uniformItemSizes; |