diff options
-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 { |