Skip to content

Commit

Permalink
Replace foreach with Q_FOREACH
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Sep 16, 2015
1 parent ed57c78 commit 70b25bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/app/nodetool/qgsmaptoolnodetool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void QgsMapToolNodeTool::createTopologyRubberBands()
{
QgsVectorLayer* vlayer = mSelectedFeature->vlayer();

foreach ( const QgsVertexEntry* vertexEntry, mSelectedFeature->vertexMap() )
Q_FOREACH ( const QgsVertexEntry* vertexEntry, mSelectedFeature->vertexMap() )
{
if ( !vertexEntry->isSelected() )
{
Expand All @@ -63,7 +63,7 @@ void QgsMapToolNodeTool::createTopologyRubberBands()
// Snap vertex
QMultiMap<double, QgsSnappingResult> snapResults;
vlayer->snapWithContext( vertexEntry->pointV1(), ZERO_TOLERANCE, snapResults, QgsSnapper::SnapToVertex );
foreach ( const QgsSnappingResult& snapResult, snapResults.values() )
Q_FOREACH ( const QgsSnappingResult& snapResult, snapResults.values() )
{
// Get geometry of snapped feature
QgsFeatureId snapFeatureId = snapResult.snappedAtGeometry;
Expand Down Expand Up @@ -120,7 +120,7 @@ void QgsMapToolNodeTool::canvasMoveEvent( QgsMapMouseEvent* e )
rbGeom->transform( *mCanvas->mapSettings().layerTransform( vlayer ) );
rb->setGeometry( rbGeom );
mMoveRubberBands.insert( mSelectedFeature->featureId(), rb );
foreach ( const QgsVertexEntry* vertexEntry, mSelectedFeature->vertexMap() )
Q_FOREACH ( const QgsVertexEntry* vertexEntry, mSelectedFeature->vertexMap() )
{
if ( vertexEntry->isSelected() )
mMoveVertices[mSelectedFeature->featureId()].append( qMakePair( vertexEntry->vertexId(), toMapCoordinates( vlayer, vertexEntry->point() ) ) );
Expand All @@ -141,10 +141,10 @@ void QgsMapToolNodeTool::canvasMoveEvent( QgsMapMouseEvent* e )
double deltaX = curPos.x() - pressPos.x();
double deltaY = curPos.y() - pressPos.y();

foreach ( const QgsFeatureId& fid, mMoveRubberBands.keys() )
Q_FOREACH ( const QgsFeatureId& fid, mMoveRubberBands.keys() )
{
typedef QPair<QgsVertexId, QgsPointV2> MoveVertex;
foreach ( const MoveVertex& pair, mMoveVertices[fid] )
Q_FOREACH ( const MoveVertex& pair, mMoveVertices[fid] )
{
QgsPointV2 newPos( pair.second.x() + deltaX, pair.second.y() + deltaY );
mMoveRubberBands.value( fid )->moveVertex( pair.first, newPos );
Expand Down
4 changes: 2 additions & 2 deletions src/app/nodetool/qgsnodeeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void QgsNodeEditor::rebuildTable()
mTableWidget->setRowCount( 0 );
int row = 0;
bool hasR = false;
foreach ( const QgsVertexEntry* entry, mSelectedFeature->vertexMap() )
Q_FOREACH ( const QgsVertexEntry* entry, mSelectedFeature->vertexMap() )
{
mTableWidget->insertRow( row );

Expand Down Expand Up @@ -227,7 +227,7 @@ void QgsNodeEditor::updateNodeSelection()
{
mSelectedFeature->blockSignals( true );
mSelectedFeature->deselectAllVertexes();
foreach ( const QModelIndex& index, mTableWidget->selectionModel()->selectedRows() )
Q_FOREACH ( const QModelIndex& index, mTableWidget->selectionModel()->selectedRows() )
{
int nodeIdx = mTableWidget->item( index.row(), 0 )->data( Qt::DisplayRole ).toInt();
mSelectedFeature->selectVertex( nodeIdx );
Expand Down
8 changes: 4 additions & 4 deletions src/app/nodetool/qgsselectedfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void QgsSelectedFeature::validationFinished()
void QgsSelectedFeature::deleteSelectedVertexes()
{
int nSelected = 0;
foreach ( QgsVertexEntry *entry, mVertexMap )
Q_FOREACH ( QgsVertexEntry *entry, mVertexMap )
{
if ( entry->isSelected() )
nSelected++;
Expand Down Expand Up @@ -302,7 +302,7 @@ void QgsSelectedFeature::deleteSelectedVertexes()
void QgsSelectedFeature::moveSelectedVertexes( const QgsVector &v )
{
int nUpdates = 0;
foreach ( QgsVertexEntry *entry, mVertexMap )
Q_FOREACH ( QgsVertexEntry *entry, mVertexMap )
{
if ( entry->isSelected() )
nUpdates++;
Expand Down Expand Up @@ -375,7 +375,7 @@ void QgsSelectedFeature::replaceVertexMap()

void QgsSelectedFeature::deleteVertexMap()
{
foreach ( QgsVertexEntry *entry, mVertexMap )
Q_FOREACH ( QgsVertexEntry *entry, mVertexMap )
{
delete entry;
}
Expand Down Expand Up @@ -468,7 +468,7 @@ void QgsSelectedFeature::invertVertexSelection( int vertexNr )

void QgsSelectedFeature::updateVertexMarkersPosition()
{
foreach ( QgsVertexEntry* vertexEntry, mVertexMap )
Q_FOREACH ( QgsVertexEntry* vertexEntry, mVertexMap )
{
vertexEntry->placeMarker();
}
Expand Down

0 comments on commit 70b25bb

Please sign in to comment.