@@ -105,7 +105,7 @@ bool QgsOfflineEditing::convertToOfflineProject( const QString &offlineDataPath,
105
105
QMap<QString, QgsVectorJoinList > joinInfoBuffer;
106
106
QMap<QString, QgsVectorLayer *> layerIdMapping;
107
107
108
- Q_FOREACH ( const QString &layerId, layerIds )
108
+ for ( const QString &layerId : layerIds )
109
109
{
110
110
QgsMapLayer *layer = QgsProject::instance ()->mapLayer ( layerId );
111
111
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer );
@@ -161,7 +161,8 @@ bool QgsOfflineEditing::convertToOfflineProject( const QString &offlineDataPath,
161
161
162
162
if ( newLayer )
163
163
{
164
- Q_FOREACH ( QgsVectorLayerJoinInfo join, it.value () )
164
+ const QList<QgsVectorLayerJoinInfo> joins = it.value ();
165
+ for ( QgsVectorLayerJoinInfo join : joins )
165
166
{
166
167
QgsVectorLayer *newJoinedLayer = layerIdMapping.value ( join.joinLayerId () );
167
168
if ( newJoinedLayer )
@@ -910,9 +911,9 @@ void QgsOfflineEditing::applyAttributesAdded( QgsVectorLayer *remoteLayer, sqlit
910
911
void QgsOfflineEditing::applyFeaturesAdded ( QgsVectorLayer *offlineLayer, QgsVectorLayer *remoteLayer, sqlite3 *db, int layerId )
911
912
{
912
913
QString sql = QStringLiteral ( " SELECT \" fid\" FROM 'log_added_features' WHERE \" layer_id\" = %1" ).arg ( layerId );
913
- QList<int > featureIdInts = sqlQueryInts ( db, sql );
914
+ const QList<int > featureIdInts = sqlQueryInts ( db, sql );
914
915
QgsFeatureIds newFeatureIds;
915
- Q_FOREACH ( int id, featureIdInts )
916
+ for ( int id : featureIdInts )
916
917
{
917
918
newFeatureIds << id;
918
919
}
@@ -1073,19 +1074,18 @@ void QgsOfflineEditing::copySymbology( QgsVectorLayer *sourceLayer, QgsVectorLay
1073
1074
void QgsOfflineEditing::updateRelations ( QgsVectorLayer *sourceLayer, QgsVectorLayer *targetLayer )
1074
1075
{
1075
1076
QgsRelationManager *relationManager = QgsProject::instance ()->relationManager ();
1076
- QList<QgsRelation> relations;
1077
- relations = relationManager->referencedRelations ( sourceLayer );
1077
+ const QList<QgsRelation> referencedRelations = relationManager->referencedRelations ( sourceLayer );
1078
1078
1079
- Q_FOREACH ( QgsRelation relation, relations )
1079
+ for ( QgsRelation relation : referencedRelations )
1080
1080
{
1081
1081
relationManager->removeRelation ( relation );
1082
1082
relation.setReferencedLayer ( targetLayer->id () );
1083
1083
relationManager->addRelation ( relation );
1084
1084
}
1085
1085
1086
- relations = relationManager->referencingRelations ( sourceLayer );
1086
+ const QList<QgsRelation> referencingRelations = relationManager->referencingRelations ( sourceLayer );
1087
1087
1088
- Q_FOREACH ( QgsRelation relation, relations )
1088
+ for ( QgsRelation relation : referencingRelations )
1089
1089
{
1090
1090
relationManager->removeRelation ( relation );
1091
1091
relation.setReferencingLayer ( targetLayer->id () );
@@ -1096,13 +1096,15 @@ void QgsOfflineEditing::updateRelations( QgsVectorLayer *sourceLayer, QgsVectorL
1096
1096
void QgsOfflineEditing::updateMapThemes ( QgsVectorLayer *sourceLayer, QgsVectorLayer *targetLayer )
1097
1097
{
1098
1098
QgsMapThemeCollection *mapThemeCollection = QgsProject::instance ()->mapThemeCollection ();
1099
- QStringList mapThemeNames = mapThemeCollection->mapThemes ();
1099
+ const QStringList mapThemeNames = mapThemeCollection->mapThemes ();
1100
1100
1101
- Q_FOREACH ( const QString &mapThemeName, mapThemeNames )
1101
+ for ( const QString &mapThemeName : mapThemeNames )
1102
1102
{
1103
1103
QgsMapThemeCollection::MapThemeRecord record = mapThemeCollection->mapThemeState ( mapThemeName );
1104
1104
1105
- Q_FOREACH ( QgsMapThemeCollection::MapThemeLayerRecord layerRecord, record.layerRecords () )
1105
+ const auto layerRecords = record.layerRecords ();
1106
+
1107
+ for ( QgsMapThemeCollection::MapThemeLayerRecord layerRecord : layerRecords )
1106
1108
{
1107
1109
if ( layerRecord.layer () == sourceLayer )
1108
1110
{
0 commit comments