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 1d859ef805
Change-Id: Ic3d06869de717963bad6357abb99f3e025642078
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
592da13664
commit
25f040820c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user