From 25f040820ce3cd97868f7e432e612532bfdca962 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Fri, 24 Jun 2016 13:59:17 +0300 Subject: 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 --- src/widgets/itemviews/qabstractitemview_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3