From ed776e367099754af6436f07d72352e6b73124da Mon Sep 17 00:00:00 2001 From: ABBAPOH Date: Thu, 14 Jun 2012 12:49:51 +0400 Subject: 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 --- src/widgets/itemviews/qabstractitemview_p.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h index 63f7488704..dc2b2dfa90 100644 --- a/src/widgets/itemviews/qabstractitemview_p.h +++ b/src/widgets/itemviews/qabstractitemview_p.h @@ -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 >::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 { -- cgit v1.2.3