summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qabstractitemview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itemviews/qabstractitemview.cpp')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index ef69b7dea6..92229a23ad 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -4133,6 +4133,10 @@ const QEditorInfo & QAbstractItemViewPrivate::editorForIndex(const QModelIndex &
{
static QEditorInfo nullInfo;
+ // do not try to search to avoid slow implicit cast from QModelIndex to QPersistentModelIndex
+ if (indexEditorHash.isEmpty())
+ return nullInfo;
+
QIndexEditorHash::const_iterator it = indexEditorHash.find(index);
if (it == indexEditorHash.end())
return nullInfo;
@@ -4142,7 +4146,11 @@ const QEditorInfo & QAbstractItemViewPrivate::editorForIndex(const QModelIndex &
QModelIndex QAbstractItemViewPrivate::indexForEditor(QWidget *editor) const
{
- QEditorIndexHash::const_iterator it = editorIndexHash.find(editor);
+ // do not try to search to avoid slow implicit cast from QModelIndex to QPersistentModelIndex
+ if (indexEditorHash.isEmpty())
+ return QModelIndex();
+
+ QEditorIndexHash::const_iterator it = editorIndexHash.find(editor);
if (it == editorIndexHash.end())
return QModelIndex();