summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorABBAPOH <ABBAPOH@nextmail.ru>2012-06-14 12:49:51 +0400
committerQt by Nokia <qt-info@nokia.com>2012-06-14 16:00:05 +0200
commited776e367099754af6436f07d72352e6b73124da (patch)
tree6de44cd9b4113a3798903bd099be0a7457dbff5d /src
parent606c21526aa4183946076e7784eea14b563a03f6 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h15
1 files changed, 11 insertions, 4 deletions
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<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 {