diff options
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index bd70e83aa3..fbe1bf944e 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -4196,6 +4196,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; @@ -4205,6 +4209,10 @@ const QEditorInfo & QAbstractItemViewPrivate::editorForIndex(const QModelIndex & QModelIndex QAbstractItemViewPrivate::indexForEditor(QWidget *editor) const { + // 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(); |