diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 0920398610..64ffdaa3b7 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -275,14 +275,13 @@ void QStandardItemPrivate::setItemData(const QMap &roles) /*! \internal */ -const QMap QStandardItemPrivate::itemData() const +QMap QStandardItemPrivate::itemData() const { QMap result; - QList::const_iterator it; - for (it = values.cbegin(); it != values.cend(); ++it){ + for (const auto &data : values) { // Qt::UserRole - 1 is used internally to store the flags - if (it->role != Qt::UserRole - 1) - result.insert(it->role, it->value); + if (data.role != Qt::UserRole - 1) + result.insert(data.role, data.value); } return result; } diff --git a/src/gui/itemmodels/qstandarditemmodel_p.h b/src/gui/itemmodels/qstandarditemmodel_p.h index 27e108434d..def6c20727 100644 --- a/src/gui/itemmodels/qstandarditemmodel_p.h +++ b/src/gui/itemmodels/qstandarditemmodel_p.h @@ -144,7 +144,7 @@ public: void changeFlags(bool enable, Qt::ItemFlags f); void setItemData(const QMap &roles); - const QMap itemData() const; + QMap itemData() const; bool insertRows(int row, int count, const QList &items); bool insertRows(int row, const QList &items);