@@ -186,7 +186,8 @@ class Raytracer
186
186
187
187
QgsSnapIndex::GridRow::~GridRow ()
188
188
{
189
- Q_FOREACH ( const QgsSnapIndex::Cell &cell, mCells )
189
+ const auto constMCells = mCells ;
190
+ for ( const QgsSnapIndex::Cell &cell : constMCells )
190
191
{
191
192
qDeleteAll ( cell );
192
193
}
@@ -373,7 +374,7 @@ QgsPoint QgsSnapIndex::getClosestSnapToPoint( const QgsPoint &p, const QgsPoint
373
374
{
374
375
continue ;
375
376
}
376
- Q_FOREACH ( const SnapItem *item, *cell )
377
+ for ( const SnapItem *item : *cell )
377
378
{
378
379
if ( item->type == SnapSegment )
379
380
{
@@ -415,7 +416,8 @@ QgsSnapIndex::SnapItem *QgsSnapIndex::getSnapItem( const QgsPoint &pos, double t
415
416
QgsSnapIndex::SegmentSnapItem *snapSegment = nullptr ;
416
417
QgsSnapIndex::PointSnapItem *snapPoint = nullptr ;
417
418
418
- Q_FOREACH ( QgsSnapIndex::SnapItem *item, items )
419
+ const auto constItems = items;
420
+ for ( QgsSnapIndex::SnapItem *item : constItems )
419
421
{
420
422
if ( ( ! endPointOnly && item->type == SnapPoint ) || item->type == SnapEndPoint )
421
423
{
@@ -510,7 +512,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl
510
512
QgsPoint ( geometry.constGet ()->boundingBox ().center () );
511
513
512
514
QgsSnapIndex refSnapIndex ( center, 10 * snapTolerance );
513
- Q_FOREACH ( const QgsGeometry &geom, referenceGeometries )
515
+ for ( const QgsGeometry &geom : referenceGeometries )
514
516
{
515
517
refSnapIndex.addGeometry ( geom.constGet () );
516
518
}
@@ -624,7 +626,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl
624
626
origSubjSnapIndex->addGeometry ( origSubjGeom.get () );
625
627
626
628
// Pass 2: add missing vertices to subject geometry
627
- Q_FOREACH ( const QgsGeometry &refGeom, referenceGeometries )
629
+ for ( const QgsGeometry &refGeom : referenceGeometries )
628
630
{
629
631
for ( int iPart = 0 , nParts = refGeom.constGet ()->partCount (); iPart < nParts; ++iPart )
630
632
{
@@ -760,7 +762,8 @@ QgsGeometry QgsInternalGeometrySnapper::snapFeature( const QgsFeature &feature )
760
762
if ( !refFeatureIds.isEmpty () )
761
763
{
762
764
QList< QgsGeometry > refGeometries;
763
- Q_FOREACH ( QgsFeatureId id, refFeatureIds )
765
+ const auto constRefFeatureIds = refFeatureIds;
766
+ for ( QgsFeatureId id : constRefFeatureIds )
764
767
{
765
768
refGeometries << mProcessedGeometries .value ( id );
766
769
}
0 commit comments