summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qabstractitemmodel_p.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-12-03 13:06:12 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2015-12-19 07:41:50 +0000
commit66441d7a828ddcdae709cf4699420147f376bdcd (patch)
treefc16433f11c0eb8dd05971566528c70686a72dcc /src/corelib/itemmodels/qabstractitemmodel_p.h
parent0f923a8ce45a0b9379bf0a43e68897a3a8333fda (diff)
Make use of new QHash::erase(const_iterator) overload
Drive-by changes: - use auto for iterators - add Q_UNLIKELY for conditions leading to a qWarning etc Change-Id: Iff8f36d67c96674d354a501b26640f73c15ce58d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel_p.h')
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel_p.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel_p.h b/src/corelib/itemmodels/qabstractitemmodel_p.h
index 77a3164959..84763dff0d 100644
--- a/src/corelib/itemmodels/qabstractitemmodel_p.h
+++ b/src/corelib/itemmodels/qabstractitemmodel_p.h
@@ -117,8 +117,8 @@ public:
To be used before an index is invalided
*/
inline void invalidatePersistentIndex(const QModelIndex &index) {
- QHash<QModelIndex, QPersistentModelIndexData *>::iterator it = persistent.indexes.find(index);
- if(it != persistent.indexes.end()) {
+ const auto it = persistent.indexes.constFind(index);
+ if (it != persistent.indexes.cend()) {
QPersistentModelIndexData *data = *it;
persistent.indexes.erase(it);
data->index = QModelIndex();