Skip to content
This repository was archived by the owner on Feb 5, 2026. It is now read-only.

Commit 33faea0

Browse files
authored
Merge pull request #3 from MenloSystems/fix-clazy-warnings
Fix clazy warnings
2 parents 3cecb2f + 5b05eec commit 33faea0

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

qqmlsortfilterproxymodel.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ void QQmlSortFilterProxyModel::componentComplete()
191191
{
192192
m_completed = true;
193193

194-
for (const auto& filter : m_filters)
194+
for (const auto& filter : qAsConst(m_filters))
195195
filter->proxyModelCompleted(*this);
196-
for (const auto& sorter : m_sorters)
196+
for (const auto& sorter : qAsConst(m_sorters))
197197
sorter->proxyModelCompleted(*this);
198-
for (const auto& proxyRole : m_proxyRoles)
198+
for (const auto& proxyRole : qAsConst(m_proxyRoles))
199199
proxyRole->proxyModelCompleted(*this);
200200

201201
invalidate();
@@ -249,7 +249,7 @@ QVariantMap QQmlSortFilterProxyModel::get(int row) const
249249
QVariantMap map;
250250
QModelIndex modelIndex = index(row, 0);
251251
QHash<int, QByteArray> roles = roleNames();
252-
for (QHash<int, QByteArray>::const_iterator it = roles.begin(); it != roles.end(); ++it)
252+
for (QHash<int, QByteArray>::const_iterator it = roles.cbegin(); it != roles.cend(); ++it)
253253
map.insert(it.value(), data(modelIndex, it.key()));
254254
return map;
255255
}
@@ -322,7 +322,7 @@ bool QQmlSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelInde
322322
bool valueAccepted = !m_filterValue.isValid() || ( m_filterValue == sourceModel()->data(sourceIndex, filterRole()) );
323323
bool baseAcceptsRow = valueAccepted && QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
324324
baseAcceptsRow = baseAcceptsRow && std::all_of(m_filters.begin(), m_filters.end(),
325-
[=, &source_parent] (Filter* filter) {
325+
[=] (Filter* filter) {
326326
return filter->filterAcceptsRow(sourceIndex, *this);
327327
}
328328
);
@@ -419,8 +419,9 @@ void QQmlSortFilterProxyModel::updateRoleNames()
419419
auto roles = m_roleNames.keys();
420420
auto maxIt = std::max_element(roles.cbegin(), roles.cend());
421421
int maxRole = maxIt != roles.cend() ? *maxIt : -1;
422-
for (auto proxyRole : m_proxyRoles) {
423-
for (auto roleName : proxyRole->names()) {
422+
for (auto proxyRole : qAsConst(m_proxyRoles)) {
423+
const auto proxyRoleNames = proxyRole->names();
424+
for (const auto &roleName : proxyRoleNames) {
424425
++maxRole;
425426
m_roleNames[maxRole] = roleName.toUtf8();
426427
m_proxyRoleMap[maxRole] = {proxyRole, roleName};
@@ -492,7 +493,7 @@ QVariantMap QQmlSortFilterProxyModel::modelDataMap(const QModelIndex& modelIndex
492493
{
493494
QVariantMap map;
494495
QHash<int, QByteArray> roles = roleNames();
495-
for (QHash<int, QByteArray>::const_iterator it = roles.begin(); it != roles.end(); ++it)
496+
for (QHash<int, QByteArray>::const_iterator it = roles.cbegin(); it != roles.cend(); ++it)
496497
map.insert(it.value(), sourceModel()->data(modelIndex, it.key()));
497498
return map;
498499
}

0 commit comments

Comments
 (0)