QStandardItemPrivate: remove const from return type in itemData

While touching code, port iterator-based loop to range-based for.

Change-Id: I108ab4fa1e56c50f424a58984873906d37923d3d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Anton Kudryavtsev 2022-11-23 23:36:40 +03:00
parent 72bff530f9
commit 6a027a8677
2 changed files with 5 additions and 6 deletions

View File

@ -275,14 +275,13 @@ void QStandardItemPrivate::setItemData(const QMap<int, QVariant> &roles)
/*!
\internal
*/
const QMap<int, QVariant> QStandardItemPrivate::itemData() const
QMap<int, QVariant> QStandardItemPrivate::itemData() const
{
QMap<int, QVariant> result;
QList<QStandardItemData>::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;
}

View File

@ -144,7 +144,7 @@ public:
void changeFlags(bool enable, Qt::ItemFlags f);
void setItemData(const QMap<int, QVariant> &roles);
const QMap<int, QVariant> itemData() const;
QMap<int, QVariant> itemData() const;
bool insertRows(int row, int count, const QList<QStandardItem*> &items);
bool insertRows(int row, const QList<QStandardItem*> &items);