summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorABBAPOH <ABBAPOH@nextmail.ru>2012-06-14 14:46:16 +0400
committerQt by Nokia <qt-info@nokia.com>2012-06-19 02:01:43 +0200
commitf9a22b03d53e324049044241cb82438e5f33e777 (patch)
treec5b1f941d032e01063d0a70505cefeddff5bf0ea /src/gui/itemviews
parent2eb8edb5983f7aeff29e45afc4c00ab7c36b0faf (diff)
Speedup for QAbstractItemViewPrivate::delegateForIndex
This fix prevents copying of a QPointer on a stack and adding/removing QMetaObject guards Backport of the ed776e367099754af6436f07d72352e6b73124da commit in qtbase Change-Id: Ie92fe1e7ac2c8d15be67404521040bf1a64b9c9a Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 0ce8bf252f..ec8912aad4 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -261,10 +261,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 {