summaryrefslogtreecommitdiffstats
path: root/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-07-03 14:23:15 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-07-04 10:20:17 +0200
commite3ec52128eebf23cfb0adb3f0b2a5426ef3b5f55 (patch)
tree4092e3999f0195d1f7d4c0fc1c9898ccb4ddfdb2 /src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
parentc9243cb82e991b4f97872282b91b64b512101738 (diff)
Eradicate some simple Q_FOREACH loops
All these are relatively easily verified to be safe: They clearly don't modify the container they iterate over, are already const or trivially marked as such. In QRegistrySource::removeServer(), merge with an adjacent loop. In tst_modelview.cpp, replaced a loop over QHash::keys() + QHash::op[] with an STL-style loop and it.key()/it.value(). In tst_signature.cpp, replaced a QStringList with a C array of QLatin1Strings, saving a qAsConst call. Add some reserve() as a drive-by. Change-Id: Ibf09371ca8b58437834734c3bab997527219c823 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp')
-rw-r--r--src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp b/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
index 6e643e2..b8ca6f3 100644
--- a/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
+++ b/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
@@ -151,9 +151,8 @@ inline void removeIndexFromRow(const QModelIndex &index, const QVector<int> &rol
if (roles.isEmpty()) {
entry.data.clear();
} else {
- Q_FOREACH (int role, roles) {
+ for (int role : roles)
entry.data.remove(role);
- }
}
}
}
@@ -601,7 +600,7 @@ void QAbstractItemModelReplicaImplementation::fetchPendingData()
const ModelIndex resEnd(std::max(curIndEnd.row, dataIndEnd.row), std::max(curIndEnd.column, dataIndEnd.column));
QVector<int> roles = curData.roles;
if (!curData.roles.isEmpty()) {
- Q_FOREACH (int role, data.roles) {
+ for (int role : data.roles) {
if (!curData.roles.contains(role))
roles.append(role);
}
@@ -673,7 +672,7 @@ void QAbstractItemModelReplicaImplementation::fetchPendingHeaderData()
QVector<int> roles;
QVector<int> sections;
QVector<Qt::Orientation> orientations;
- Q_FOREACH (const RequestedHeaderData &data, m_requestedHeaderData) {
+ for (const RequestedHeaderData &data : qAsConst(m_requestedHeaderData)) {
roles.push_back(data.role);
sections.push_back(data.section);
orientations.push_back(data.orientation);