Skip to content
Permalink
Browse files

Replace foreach with Q_FOREACH

  • Loading branch information
mhugent committed Sep 16, 2015
1 parent ed57c78 commit 70b25bbff948afa34831f8384ea7fa05df5c9b81
@@ -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() )
{
@@ -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;
@@ -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() ) ) );
@@ -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 );
@@ -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 );

@@ -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 );
@@ -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++;
@@ -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++;
@@ -375,7 +375,7 @@ void QgsSelectedFeature::replaceVertexMap()

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

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

0 comments on commit 70b25bb

Please sign in to comment.
You can’t perform that action at this time.