Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions qqmlsortfilterproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ void QQmlSortFilterProxyModel::componentComplete()
{
m_completed = true;

for (const auto& filter : m_filters)
for (const auto& filter : qAsConst(m_filters))
filter->proxyModelCompleted(*this);
for (const auto& sorter : m_sorters)
for (const auto& sorter : qAsConst(m_sorters))
sorter->proxyModelCompleted(*this);
for (const auto& proxyRole : m_proxyRoles)
for (const auto& proxyRole : qAsConst(m_proxyRoles))
proxyRole->proxyModelCompleted(*this);

invalidate();
Expand Down Expand Up @@ -266,7 +266,7 @@ QVariantMap QQmlSortFilterProxyModel::get(int row) const
QVariantMap map;
QModelIndex modelIndex = index(row, 0);
QHash<int, QByteArray> roles = roleNames();
for (QHash<int, QByteArray>::const_iterator it = roles.begin(); it != roles.end(); ++it)
for (QHash<int, QByteArray>::const_iterator it = roles.cbegin(); it != roles.cend(); ++it)
map.insert(it.value(), data(modelIndex, it.key()));
return map;
}
Expand Down Expand Up @@ -339,7 +339,7 @@ bool QQmlSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelInde
bool valueAccepted = !m_filterValue.isValid() || ( m_filterValue == sourceModel()->data(sourceIndex, filterRole()) );
bool baseAcceptsRow = valueAccepted && QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
baseAcceptsRow = baseAcceptsRow && std::all_of(m_filters.begin(), m_filters.end(),
[=, &source_parent] (Filter* filter) {
[=] (Filter* filter) {
return filter->filterAcceptsRow(sourceIndex, *this);
}
);
Expand Down Expand Up @@ -436,8 +436,9 @@ void QQmlSortFilterProxyModel::updateRoleNames()
auto roles = m_roleNames.keys();
auto maxIt = std::max_element(roles.cbegin(), roles.cend());
int maxRole = maxIt != roles.cend() ? *maxIt : -1;
for (auto proxyRole : m_proxyRoles) {
for (auto roleName : proxyRole->names()) {
for (auto proxyRole : qAsConst(m_proxyRoles)) {
const auto proxyRoleNames = proxyRole->names();
for (const auto &roleName : proxyRoleNames) {
++maxRole;
m_roleNames[maxRole] = roleName.toUtf8();
m_proxyRoleMap[maxRole] = {proxyRole, roleName};
Expand Down Expand Up @@ -509,7 +510,7 @@ QVariantMap QQmlSortFilterProxyModel::modelDataMap(const QModelIndex& modelIndex
{
QVariantMap map;
QHash<int, QByteArray> roles = roleNames();
for (QHash<int, QByteArray>::const_iterator it = roles.begin(); it != roles.end(); ++it)
for (QHash<int, QByteArray>::const_iterator it = roles.cbegin(); it != roles.cend(); ++it)
map.insert(it.value(), sourceModel()->data(modelIndex, it.key()));
return map;
}
Expand Down