@@ -1079,7 +1079,8 @@ void QgsNodeTool::startDraggingMoveVertex( const QgsPointLocator::Match &m )
1079
1079
if ( !vlayer || !vlayer->isEditable () )
1080
1080
continue ;
1081
1081
1082
- for ( const QgsPointLocator::Match &otherMatch : layerVerticesSnappedToPoint ( vlayer, m.point () ) )
1082
+ const auto snappedVertices = layerVerticesSnappedToPoint ( vlayer, m.point () );
1083
+ for ( const QgsPointLocator::Match &otherMatch : snappedVertices )
1083
1084
{
1084
1085
if ( otherMatch.layer () == m.layer () &&
1085
1086
otherMatch.featureId () == m.featureId () &&
@@ -1436,7 +1437,8 @@ void QgsNodeTool::moveVertex( const QgsPointXY &mapPoint, const QgsPointLocator:
1436
1437
// topo editing: add vertex to existing segments when moving/adding a vertex to such segment.
1437
1438
// this requires that the snapping match is to a segment and the segment layer's CRS
1438
1439
// is the same (otherwise we would need to reproject the point and it will not be coincident)
1439
- for ( QgsVectorLayer *layer : edits.keys () )
1440
+ const auto editKeys = edits.keys ();
1441
+ for ( QgsVectorLayer *layer : editKeys )
1440
1442
{
1441
1443
if ( layer->crs () == mapPointMatch->layer ()->crs () )
1442
1444
{
@@ -1531,11 +1533,12 @@ void QgsNodeTool::deleteVertex()
1531
1533
{
1532
1534
// if topo editing is enabled, delete all the vertices that are on the same location
1533
1535
QSet<Vertex> topoVerticesToDelete;
1534
- for ( const Vertex &vertexToDelete : toDelete )
1536
+ for ( const Vertex &vertexToDelete : qgsAsConst ( toDelete ) )
1535
1537
{
1536
1538
QgsPointXY layerPt = cachedGeometryForVertex ( vertexToDelete ).vertexAt ( vertexToDelete.vertexId );
1537
1539
QgsPointXY mapPt = toMapCoordinates ( vertexToDelete.layer , layerPt );
1538
- for ( const QgsPointLocator::Match &otherMatch : layerVerticesSnappedToPoint ( vertexToDelete.layer , mapPt ) )
1540
+ const auto snappedVertices = layerVerticesSnappedToPoint ( vertexToDelete.layer , mapPt );
1541
+ for ( const QgsPointLocator::Match &otherMatch : snappedVertices )
1539
1542
{
1540
1543
Vertex otherVertex ( otherMatch.layer (), otherMatch.featureId (), otherMatch.vertexIndex () );
1541
1544
if ( toDelete.contains ( otherVertex ) || topoVerticesToDelete.contains ( otherVertex ) )
@@ -1550,7 +1553,7 @@ void QgsNodeTool::deleteVertex()
1550
1553
1551
1554
// switch from a plain list to dictionary { layer: { fid: [vertexNr1, vertexNr2, ...] } }
1552
1555
QHash<QgsVectorLayer *, QHash<QgsFeatureId, QList<int > > > toDeleteGrouped;
1553
- for ( const Vertex &vertex : toDelete )
1556
+ for ( const Vertex &vertex : qgsAsConst ( toDelete ) )
1554
1557
{
1555
1558
toDeleteGrouped[vertex.layer ][vertex.fid ].append ( vertex.vertexId );
1556
1559
}
@@ -1586,7 +1589,7 @@ void QgsNodeTool::deleteVertex()
1586
1589
}
1587
1590
}
1588
1591
// now delete the duplicities
1589
- for ( int duplicateVertexIndex : duplicateVertexIndices )
1592
+ for ( int duplicateVertexIndex : qgsAsConst ( duplicateVertexIndices ) )
1590
1593
vertexIds.removeOne ( duplicateVertexIndex );
1591
1594
}
1592
1595
}
@@ -1779,7 +1782,7 @@ void QgsNodeTool::CircularBand::updateRubberBand( const QgsPointXY &mapPoint )
1779
1782
QgsGeometryUtils::segmentizeArc ( QgsPoint ( v0 ), QgsPoint ( v1 ), QgsPoint ( v2 ), points );
1780
1783
// it would be useful to have QgsRubberBand::setPoints() call
1781
1784
band->reset ();
1782
- for ( const QgsPoint &p : points )
1785
+ for ( const QgsPoint &p : qgsAsConst ( points ) )
1783
1786
band->addPoint ( p );
1784
1787
}
1785
1788
0 commit comments