Skip to content

Commit 2dbda4f

Browse files
committedFeb 2, 2018
Fix clazy container detach warnings
1 parent 7400b46 commit 2dbda4f

22 files changed

+72
-59
lines changed
 

‎src/analysis/processing/qgsalgorithmaddincrementalfield.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ QgsFeature QgsAddIncrementalFieldAlgorithm::processFeature( const QgsFeature &fe
9999
{
100100
if ( !mGroupedFieldNames.empty() && mGroupedFields.empty() )
101101
{
102-
for ( const QString &field : mGroupedFieldNames )
102+
for ( const QString &field : qgis::as_const( mGroupedFieldNames ) )
103103
{
104104
int idx = mFields.lookupField( field );
105105
if ( idx >= 0 )

‎src/analysis/vector/geometry_checker/qgsgeometryareacheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ bool QgsGeometryAreaCheck::mergeWithNeighbor( const QString &layerId, QgsFeature
114114
const QgsAbstractGeometry *geom = featureGeometry.constGet();
115115

116116
// Search for touching neighboring geometries
117-
for ( QgsFeatureId testId : featurePool->getIntersects( featureGeometry.boundingBox() ) )
117+
const QgsFeatureIds intersects = featurePool->getIntersects( featureGeometry.boundingBox() );
118+
for ( QgsFeatureId testId : intersects )
118119
{
119120
QgsFeature testFeature;
120121
if ( !featurePool->get( testId, testFeature ) )

‎src/analysis/vector/geometry_checker/qgsgeometrycheck.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ class ANALYSIS_EXPORT QgsGeometryCheckError
134134
void setFixed( int method )
135135
{
136136
mStatus = StatusFixed;
137-
mResolutionMessage = mCheck->getResolutionMethods()[method];
137+
const QStringList methods = mCheck->getResolutionMethods();
138+
mResolutionMessage = methods[method];
138139
}
139140
void setFixFailed( const QString &reason )
140141
{

‎src/analysis/vector/geometry_checker/qgsgeometrychecker.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ QgsGeometryChecker::QgsGeometryChecker( const QList<QgsGeometryCheck *> &checks,
2929
: mChecks( checks )
3030
, mContext( context )
3131
{
32-
for ( const QgsFeaturePool *featurePool : mContext->featurePools.values() )
32+
for ( auto it = mContext->featurePools.constBegin(); it != mContext->featurePools.constEnd(); ++it )
3333
{
34-
if ( featurePool->getLayer() )
34+
if ( it.value()->getLayer() )
3535
{
36-
featurePool->getLayer()->setReadOnly( true );
36+
it.value()->getLayer()->setReadOnly( true );
3737
// Enter update mode to defer ogr dataset repacking until the checker has finished
38-
featurePool->getLayer()->dataProvider()->enterUpdateMode();
38+
it.value()->getLayer()->dataProvider()->enterUpdateMode();
3939
}
4040
}
4141
}
@@ -44,14 +44,14 @@ QgsGeometryChecker::~QgsGeometryChecker()
4444
{
4545
qDeleteAll( mCheckErrors );
4646
qDeleteAll( mChecks );
47-
for ( const QgsFeaturePool *featurePool : mContext->featurePools.values() )
47+
for ( auto it = mContext->featurePools.constBegin(); it != mContext->featurePools.constEnd(); ++it )
4848
{
49-
if ( featurePool->getLayer() )
49+
if ( it.value()->getLayer() )
5050
{
51-
featurePool->getLayer()->dataProvider()->leaveUpdateMode();
52-
featurePool->getLayer()->setReadOnly( false );
51+
it.value()->getLayer()->dataProvider()->leaveUpdateMode();
52+
it.value()->getLayer()->setReadOnly( false );
5353
}
54-
delete featurePool;
54+
delete it.value();
5555
}
5656
delete mContext;
5757
}
@@ -61,13 +61,13 @@ QFuture<void> QgsGeometryChecker::execute( int *totalSteps )
6161
if ( totalSteps )
6262
{
6363
*totalSteps = 0;
64-
for ( QgsGeometryCheck *check : mChecks )
64+
for ( QgsGeometryCheck *check : qgis::as_const( mChecks ) )
6565
{
66-
for ( const QgsFeaturePool *featurePool : mContext->featurePools.values() )
66+
for ( auto it = mContext->featurePools.constBegin(); it != mContext->featurePools.constEnd(); ++it )
6767
{
6868
if ( check->getCheckType() <= QgsGeometryCheck::FeatureCheck )
6969
{
70-
*totalSteps += check->getCompatibility( featurePool->getLayer()->geometryType() ) ? featurePool->getFeatureIds().size() : 0;
70+
*totalSteps += check->getCompatibility( it.value()->getLayer()->geometryType() ) ? it.value()->getFeatureIds().size() : 0;
7171
}
7272
else
7373
{
@@ -140,15 +140,15 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
140140
// Determine what to recheck
141141
// - Collect all features which were changed, get affected area
142142
QMap<QString, QSet<QgsFeatureId>> recheckFeatures;
143-
for ( const QString &layerId : changes.keys() )
143+
for ( auto it = changes.constBegin(); it != changes.constEnd(); ++it )
144144
{
145-
const QMap<QgsFeatureId, QList<QgsGeometryCheck::Change>> &layerChanges = changes[layerId];
146-
QgsFeaturePool *featurePool = mContext->featurePools[layerId];
145+
const QMap<QgsFeatureId, QList<QgsGeometryCheck::Change>> &layerChanges = it.value();
146+
QgsFeaturePool *featurePool = mContext->featurePools[it.key()];
147147
QgsCoordinateTransform t( featurePool->getLayer()->crs(), mContext->mapCrs, QgsProject::instance() );
148-
for ( QgsFeatureId id : layerChanges.keys() )
148+
for ( auto layerChangeIt = layerChanges.constBegin(); layerChangeIt != layerChanges.constEnd(); ++layerChangeIt )
149149
{
150150
bool removed = false;
151-
for ( const QgsGeometryCheck::Change &change : layerChanges.value( id ) )
151+
for ( const QgsGeometryCheck::Change &change : layerChangeIt.value() )
152152
{
153153
if ( change.what == QgsGeometryCheck::ChangeFeature && change.type == QgsGeometryCheck::ChangeRemoved )
154154
{
@@ -159,16 +159,16 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
159159
if ( !removed )
160160
{
161161
QgsFeature f;
162-
if ( featurePool->get( id, f ) )
162+
if ( featurePool->get( layerChangeIt.key(), f ) )
163163
{
164-
recheckFeatures[layerId].insert( id );
164+
recheckFeatures[it.key()].insert( layerChangeIt.key() );
165165
recheckArea.combineExtentWith( t.transformBoundingBox( f.geometry().boundingBox() ) );
166166
}
167167
}
168168
}
169169
}
170170
// - Determine extent to recheck for gaps
171-
for ( QgsGeometryCheckError *err : mCheckErrors )
171+
for ( QgsGeometryCheckError *err : qgis::as_const( mCheckErrors ) )
172172
{
173173
if ( err->check()->getCheckType() == QgsGeometryCheck::LayerCheck )
174174
{
@@ -189,7 +189,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
189189

190190
// Recheck feature / changed area to detect new errors
191191
QList<QgsGeometryCheckError *> recheckErrors;
192-
for ( const QgsGeometryCheck *check : mChecks )
192+
for ( const QgsGeometryCheck *check : qgis::as_const( mChecks ) )
193193
{
194194
if ( check->getCheckType() == QgsGeometryCheck::LayerCheck )
195195
{
@@ -208,7 +208,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
208208
}
209209

210210
// Go through error list, update other errors of the checked feature
211-
for ( QgsGeometryCheckError *err : mCheckErrors )
211+
for ( QgsGeometryCheckError *err : qgis::as_const( mCheckErrors ) )
212212
{
213213
if ( err == error || err->status() == QgsGeometryCheckError::StatusObsolete )
214214
{
@@ -222,7 +222,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
222222
// Check if this error now matches one found when rechecking the feature/area
223223
QgsGeometryCheckError *matchErr = nullptr;
224224
int nMatch = 0;
225-
for ( QgsGeometryCheckError *recheckErr : recheckErrors )
225+
for ( QgsGeometryCheckError *recheckErr : qgis::as_const( recheckErrors ) )
226226
{
227227
if ( recheckErr->isEqual( err ) || recheckErr->closeMatch( err ) )
228228
{
@@ -258,7 +258,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
258258
}
259259

260260
// Add new errors
261-
for ( QgsGeometryCheckError *recheckErr : recheckErrors )
261+
for ( QgsGeometryCheckError *recheckErr : qgis::as_const( recheckErrors ) )
262262
{
263263
emit errorAdded( recheckErr );
264264
mCheckErrors.append( recheckErr );
@@ -285,7 +285,7 @@ void QgsGeometryChecker::runCheck( const QgsGeometryCheck *check )
285285
mCheckErrors.append( errors );
286286
mMessages.append( messages );
287287
mErrorListMutex.unlock();
288-
for ( QgsGeometryCheckError *error : errors )
288+
for ( QgsGeometryCheckError *error : qgis::as_const( errors ) )
289289
{
290290
emit errorAdded( error );
291291
}

‎src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
QString QgsGeometryDuplicateCheckError::duplicatesString( const QMap<QString, QgsFeaturePool *> &featurePools, const QMap<QString, QList<QgsFeatureId>> &duplicates )
2323
{
2424
QStringList str;
25-
for ( const QString &layerId : duplicates.keys() )
25+
for ( auto it = duplicates.constBegin(); it != duplicates.constEnd(); ++it )
2626
{
27-
str.append( featurePools[layerId]->getLayer()->name() + ":" );
27+
str.append( featurePools[it.key()]->getLayer()->name() + ":" );
2828
QStringList ids;
29-
for ( QgsFeatureId id : duplicates[layerId] )
29+
for ( QgsFeatureId id : it.value() )
3030
{
3131
ids.append( QString::number( id ) );
3232
}

‎src/analysis/vector/geometry_checker/qgsgeometrylineintersectioncheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ void QgsGeometryLineIntersectionCheck::collectErrors( QList<QgsGeometryCheckErro
5959
{
6060
continue;
6161
}
62-
for ( const QgsPoint &inter : QgsGeometryCheckerUtils::lineIntersections( line, testLine, mContext->tolerance ) )
62+
const QList< QgsPoint > intersections = QgsGeometryCheckerUtils::lineIntersections( line, testLine, mContext->tolerance );
63+
for ( const QgsPoint &inter : intersections )
6364
{
6465
errors.append( new QgsGeometryCheckError( this, layerFeatureA, inter, QgsVertexId( iPart ), layerFeatureB.id() ) );
6566
}

‎src/analysis/vector/geometry_checker/qgsgeometrylinelayerintersectioncheck.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,19 @@ void QgsGeometryLineLayerIntersectionCheck::collectErrors( QList<QgsGeometryChec
4545
const QgsAbstractGeometry *part = QgsGeometryCheckerUtils::getGeomPart( testGeom, jPart );
4646
if ( const QgsLineString *testLine = dynamic_cast<const QgsLineString *>( part ) )
4747
{
48-
for ( const QgsPoint &inter : QgsGeometryCheckerUtils::lineIntersections( line, testLine, mContext->tolerance ) )
48+
const QList< QgsPoint > intersections = QgsGeometryCheckerUtils::lineIntersections( line, testLine, mContext->tolerance );
49+
for ( const QgsPoint &inter : intersections )
4950
{
5051
errors.append( new QgsGeometryCheckError( this, layerFeature, inter, QgsVertexId( iPart ), checkFeature.id() ) );
5152
}
5253
}
5354
else if ( const QgsPolygon *polygon = dynamic_cast<const QgsPolygon *>( part ) )
5455
{
55-
for ( const QgsLineString *ring : QgsGeometryCheckerUtils::polygonRings( polygon ) )
56+
QList< const QgsLineString* > rings = QgsGeometryCheckerUtils::polygonRings( polygon );
57+
for ( const QgsLineString *ring : rings )
5658
{
57-
for ( const QgsPoint &inter : QgsGeometryCheckerUtils::lineIntersections( line, ring, mContext->tolerance ) )
59+
const QList< QgsPoint > intersections = QgsGeometryCheckerUtils::lineIntersections( line, ring, mContext->tolerance );
60+
for ( const QgsPoint &inter : intersections )
5861
{
5962
errors.append( new QgsGeometryCheckError( this, layerFeature, inter, QgsVertexId( iPart ), checkFeature.id() ) );
6063
}

‎src/core/layertree/qgslayertree.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ QList<QgsMapLayer *> QgsLayerTree::layerOrder() const
8181
else
8282
{
8383
QList<QgsMapLayer *> layers;
84-
for ( const auto &treeLayer : findLayers() )
84+
const QList< QgsLayerTreeLayer * > foundLayers = findLayers();
85+
for ( const auto &treeLayer : foundLayers )
8586
{
8687
QgsMapLayer *layer = treeLayer->layer();
8788
if ( !layer || !layer->isSpatial() )
@@ -212,7 +213,8 @@ void QgsLayerTree::addMissingLayers()
212213
{
213214
bool changed = false;
214215

215-
for ( const auto layer : findLayers() )
216+
const QList< QgsLayerTreeLayer * > foundLayers = findLayers();
217+
for ( const auto layer : foundLayers )
216218
{
217219
if ( !mCustomLayerOrder.contains( layer->layer() ) &&
218220
layer->layer() && layer->layer()->isSpatial() )

‎src/core/layertree/qgslayertreemodel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
303303
if ( !layer->abstract().isEmpty() )
304304
{
305305
parts << QStringLiteral();
306-
for ( const auto &l : layer->abstract().split( "\n" ) )
306+
const QStringList abstractLines = layer->abstract().split( "\n" );
307+
for ( const auto &l : abstractLines )
307308
{
308309
parts << l.toHtmlEscaped();
309310
}

‎src/core/layout/qgslayoutexporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToImage( const QString
333333
}
334334
else
335335
{
336-
for ( int page : settings.pages )
336+
for ( int page : qgis::as_const( settings.pages ) )
337337
{
338338
if ( page >= 0 && page < mLayout->pageCollection()->pageCount() )
339339
pages << page;

‎src/core/layout/qgslayoutitemgroupundocommand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void QgsLayoutItemGroupUndoCommand::switchState()
7575
mLayout->addLayoutItemPrivate( group );
7676
}
7777

78-
for ( const QString &childUuid : mItemUuids )
78+
for ( const QString &childUuid : qgis::as_const( mItemUuids ) )
7979
{
8080
QgsLayoutItem *childItem = mLayout->itemByUuid( childUuid );
8181
group->addItem( childItem );

‎src/core/layout/qgslayoutitemmapitem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ bool QgsLayoutItemMapItemStack::writeXml( QDomElement &elem, QDomDocument &doc,
201201

202202
void QgsLayoutItemMapItemStack::finalizeRestoreFromXml()
203203
{
204-
for ( QgsLayoutItemMapItem *item : mItems )
204+
for ( QgsLayoutItemMapItem *item : qgis::as_const( mItems ) )
205205
{
206206
item->finalizeRestoreFromXml();
207207
}

‎src/core/qgsarchive.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ QString QgsProjectArchive::auxiliaryStorageFile() const
141141
{
142142
const QString extension = QgsAuxiliaryStorage::extension();
143143

144-
for ( const QString &file : files() )
144+
const QStringList fileList = files();
145+
for ( const QString &file : fileList )
145146
{
146147
const QFileInfo fileInfo( file );
147148
if ( fileInfo.suffix().compare( extension, Qt::CaseInsensitive ) == 0 )

‎src/core/qgsauxiliarystorage.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ int QgsAuxiliaryLayer::createProperty( QgsPalLayerSettings::Property property, Q
232232
{
233233
const QgsProperty prop = QgsProperty::fromField( fieldName );
234234

235-
for ( const QString &providerId : layer->labeling()->subProviders() )
235+
const QStringList subProviderIds = layer->labeling()->subProviders();
236+
for ( const QString &providerId : subProviderIds )
236237
{
237238
QgsPalLayerSettings *settings = new QgsPalLayerSettings( layer->labeling()->settings( providerId ) );
238239

‎src/core/qgsproject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2295,7 +2295,7 @@ QList<QgsMapLayer *> QgsProject::addMapLayers(
22952295
bool addToLegend,
22962296
bool takeOwnership )
22972297
{
2298-
QList<QgsMapLayer *> myResultList = mLayerStore->addMapLayers( layers, takeOwnership );
2298+
const QList<QgsMapLayer *> myResultList = mLayerStore->addMapLayers( layers, takeOwnership );
22992299
if ( !myResultList.isEmpty() )
23002300
{
23012301
if ( addToLegend )

‎src/core/qgsrulebasedlabeling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ QgsRuleBasedLabeling::Rule *QgsRuleBasedLabeling::Rule::findRuleByKey( const QSt
182182
if ( key == mRuleKey )
183183
return this;
184184

185-
for ( Rule *rule : mChildren )
185+
for ( Rule *rule : qgis::as_const( mChildren ) )
186186
{
187187
Rule *r = rule->findRuleByKey( key );
188188
if ( r )

‎src/core/qgsvectorlayerutils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ QgsFeature QgsVectorLayerUtils::duplicateFeature( QgsVectorLayer *layer, const Q
362362
//set childlayer editable
363363
relation.referencingLayer()->startEditing();
364364
//change the fk of the child to the id of the new parent
365-
for ( const QgsRelation::FieldPair &fieldPair : relation.fieldPairs() )
365+
const auto pairs = relation.fieldPairs();
366+
for ( const QgsRelation::FieldPair &fieldPair : pairs )
366367
{
367368
childFeature.setAttribute( fieldPair.first, newFeature.attribute( fieldPair.second ) );
368369
}

‎src/gui/auth/qgsauthsslerrorsdialog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ void QgsAuthSslErrorsDialog::showCertificateChainInfo()
137137

138138
void QgsAuthSslErrorsDialog::showCertificateChainCAsInfo()
139139
{
140-
for ( const auto &cert : mSslConfiguration.caCertificates() )
140+
const QList< QSslCertificate > certificates = mSslConfiguration.caCertificates();
141+
for ( const auto &cert : certificates )
141142
{
142143
qDebug() << cert.subjectInfo( QSslCertificate::SubjectInfo::CommonName );
143144
}

‎src/gui/editorwidgets/qgsrelationreferencewidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ void QgsRelationReferenceWidget::init()
442442

443443
if ( !mFilterFields.isEmpty() )
444444
{
445-
for ( const QString &fieldName : mFilterFields )
445+
for ( const QString &fieldName : qgis::as_const( mFilterFields ) )
446446
{
447447
int idx = mReferencedLayer->fields().lookupField( fieldName );
448448

‎src/gui/qgsrubberband.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ void QgsRubberBand::addGeometry( const QgsGeometry &geometry, const QgsCoordinat
272272
else if ( QgsWkbTypes::geometryType( geomType ) == QgsWkbTypes::PointGeometry && QgsWkbTypes::isMultiType( geomType ) )
273273
{
274274
const QgsMultiPointXY mpt = geom.asMultiPoint();
275-
for ( QgsPointXY pt : mpt )
275+
for ( const QgsPointXY &pt : mpt )
276276
{
277277
addPoint( pt, false, idx );
278278
removeLastPoint( idx, false );
@@ -282,7 +282,7 @@ void QgsRubberBand::addGeometry( const QgsGeometry &geometry, const QgsCoordinat
282282
else if ( QgsWkbTypes::geometryType( geomType ) == QgsWkbTypes::LineGeometry && !QgsWkbTypes::isMultiType( geomType ) )
283283
{
284284
const QgsPolylineXY line = geom.asPolyline();
285-
for ( QgsPointXY pt : line )
285+
for ( const QgsPointXY &pt : line )
286286
{
287287
addPoint( pt, false, idx );
288288
}
@@ -296,7 +296,7 @@ void QgsRubberBand::addGeometry( const QgsGeometry &geometry, const QgsCoordinat
296296
{
297297
continue;
298298
}
299-
for ( QgsPointXY pt : line )
299+
for ( const QgsPointXY &pt : line )
300300
{
301301
addPoint( pt, false, idx );
302302
}
@@ -307,7 +307,7 @@ void QgsRubberBand::addGeometry( const QgsGeometry &geometry, const QgsCoordinat
307307
{
308308
const QgsPolygonXY poly = geom.asPolygon();
309309
const QgsPolylineXY line = poly.at( 0 );
310-
for ( QgsPointXY pt : line )
310+
for ( const QgsPointXY &pt : line )
311311
{
312312
addPoint( pt, false, idx );
313313
}
@@ -321,7 +321,7 @@ void QgsRubberBand::addGeometry( const QgsGeometry &geometry, const QgsCoordinat
321321
continue;
322322

323323
const QgsPolylineXY line = poly.at( 0 );
324-
for ( QgsPointXY pt : line )
324+
for ( const QgsPointXY &pt : line )
325325
{
326326
addPoint( pt, false, idx );
327327
}

‎src/plugins/geometry_checker/qgsgeometrycheckerresulttab.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ void QgsGeometryCheckerResultTab::fixErrors( bool prompt )
461461
rows = ui.tableWidgetErrors->selectionModel()->selectedRows();
462462
}
463463
QList<QgsGeometryCheckError *> errors;
464-
for ( const QModelIndex &index : rows )
464+
for ( const QModelIndex &index : qgis::as_const( rows ) )
465465
{
466466
QgsGeometryCheckError *error = ui.tableWidgetErrors->item( index.row(), 0 )->data( Qt::UserRole ).value<QgsGeometryCheckError *>();
467467
if ( error->status() < QgsGeometryCheckError::StatusFixed )
@@ -507,7 +507,7 @@ void QgsGeometryCheckerResultTab::fixErrors( bool prompt )
507507
ui.progressBarFixErrors->setVisible( true );
508508
ui.progressBarFixErrors->setRange( 0, errors.size() );
509509

510-
for ( QgsGeometryCheckError *error : errors )
510+
for ( QgsGeometryCheckError *error : qgis::as_const( errors ) )
511511
{
512512
int fixMethod = QgsSettings().value( sSettingsGroup + error->check()->errorName(), QVariant::fromValue<int>( 0 ) ).toInt();
513513
mChecker->fixError( error, fixMethod );

‎src/plugins/geometry_checker/qgsgeometrycheckersetuptab.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ void QgsGeometryCheckerSetupTab::runChecks()
369369

370370
// Check if output layers are editable
371371
QList<QgsVectorLayer *> nonEditableLayers;
372-
for ( QgsVectorLayer *layer : processLayers )
372+
for ( QgsVectorLayer *layer : qgis::as_const( processLayers ) )
373373
{
374374
if ( ( layer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeGeometries ) == 0 )
375375
{
@@ -387,7 +387,7 @@ void QgsGeometryCheckerSetupTab::runChecks()
387387
{
388388
if ( ui.radioButtonOutputNew->isChecked() )
389389
{
390-
for ( QgsVectorLayer *layer : processLayers )
390+
for ( QgsVectorLayer *layer : qgis::as_const( processLayers ) )
391391
{
392392
QString layerPath = layer->dataProvider()->dataSourceUri();
393393
delete layer;
@@ -412,7 +412,7 @@ void QgsGeometryCheckerSetupTab::runChecks()
412412
ui.labelStatus->setText( tr( "<b>Building spatial index...</b>" ) );
413413
QApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
414414
QMap<QString, QgsFeaturePool *> featurePools;
415-
for ( QgsVectorLayer *layer : processLayers )
415+
for ( QgsVectorLayer *layer : qgis::as_const( processLayers ) )
416416
{
417417
double layerToMapUntis = mIface->mapCanvas()->mapSettings().layerToMapUnits( layer );
418418
QgsCoordinateTransform layerToMapTransform( layer->crs(), QgsProject::instance()->crs(), QgsProject::instance() );
@@ -446,7 +446,7 @@ void QgsGeometryCheckerSetupTab::runChecks()
446446
if ( ui.radioButtonOutputNew->isChecked() )
447447
{
448448
QList<QgsMapLayer *> addLayers;
449-
for ( QgsVectorLayer *layer : processLayers )
449+
for ( QgsVectorLayer *layer : qgis::as_const( processLayers ) )
450450
{
451451
addLayers.append( layer );
452452
}

0 commit comments

Comments
 (0)
Please sign in to comment.