summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-06-24 13:59:17 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-06-30 04:57:16 +0000
commit25f040820ce3cd97868f7e432e612532bfdca962 (patch)
treeb46c48362d1418f179727daf71b0cd3d8acace5b /src
parent592da13664b9c946ab793bd576cf83ed3c2b80e6 (diff)
QAbstractItemView: avoid search through QIndexEditorHash
Search's implicit cast (QModelIndex to QPersistentModelIndex) is slow. Use cheap pre-test to avoid when we can. Use method from 1d859ef80540ec3dd64f4f7bda3a8e415965650c Change-Id: Ic3d06869de717963bad6357abb99f3e025642078 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index a3af79abcb..60ae1559b1 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -277,7 +277,8 @@ public:
const QEditorInfo &editorForIndex(const QModelIndex &index) const;
inline bool hasEditor(const QModelIndex &index) const {
- return indexEditorHash.find(index) != indexEditorHash.constEnd();
+ // Search's implicit cast (QModelIndex to QPersistentModelIndex) is slow; use cheap pre-test to avoid when we can.
+ return !indexEditorHash.isEmpty() && indexEditorHash.contains(index);
}
QModelIndex indexForEditor(QWidget *editor) const;