diff options
author | ABBAPOH <ABBAPOH@nextmail.ru> | 2012-06-14 10:46:16 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-19 00:01:43 (GMT) |
commit | f9a22b03d53e324049044241cb82438e5f33e777 (patch) | |
tree | c5b1f941d032e01063d0a70505cefeddff5bf0ea /src/gui/itemviews | |
parent | 2eb8edb5983f7aeff29e45afc4c00ab7c36b0faf (diff) | |
download | Qt-f9a22b03d53e324049044241cb82438e5f33e777.zip Qt-f9a22b03d53e324049044241cb82438e5f33e777.tar.gz Qt-f9a22b03d53e324049044241cb82438e5f33e777.tar.bz2 |
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.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 0ce8bf2..ec8912a 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 { |