Speedup for QAbstractItemViewPrivate::delegateForIndex

This fix prevents copying of a QPointer on a stack and adding/removing
QMetaObject guards

Change-Id: I844c10cede1536a14ad7cd9f007470966619d6d6
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
ABBAPOH 2012-06-14 12:49:51 +04:00 committed by Qt by Nokia
parent 606c21526a
commit ed776e3670

View File

@ -270,10 +270,17 @@ public:
}
inline QAbstractItemDelegate *delegateForIndex(const QModelIndex &index) const {
QAbstractItemDelegate *del;
if ((del = rowDelegates.value(index.row(), 0))) return del;
if ((del = columnDelegates.value(index.column(), 0))) return del;
return itemDelegate;
QMap<int, QPointer<QAbstractItemDelegate> >::ConstIterator it;
it = rowDelegates.find(index.row());
if (it != rowDelegates.end())
return it.value();
it = columnDelegates.find(index.column());
if (it != columnDelegates.end())
return it.value();
return itemDelegate;
}
inline bool isIndexValid(const QModelIndex &index) const {