Skip to content

Commit

Permalink
iterate through features with iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Oct 25, 2018
1 parent 5bcff46 commit cb19b34
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/qgsmaptoolfeatureaction.cpp
Expand Up @@ -138,17 +138,17 @@ bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y )
else
{
QMenu *featureMenu = new QMenu();
for ( int idx = 0; idx < features.count(); idx++ )
for ( const QgsFeature &feature : features )
{
QAction *featureAction = featureMenu->addAction( FID_TO_STRING( features.at( idx ).id() ) );
connect( featureAction, &QAction::triggered, this, [ = ] { doActionForFeature( layer, features.at( idx ), point );} );
QAction *featureAction = featureMenu->addAction( FID_TO_STRING( feature.id() ) );
connect( featureAction, &QAction::triggered, this, [ = ] { doActionForFeature( layer, feature, point );} );
}
QAction *allFeatureAction = featureMenu->addAction( tr( "All Features" ) );
connect( allFeatureAction, &QAction::triggered, this, [ = ]
{
for ( int idx = 0; idx < features.count(); idx++ )
for ( const QgsFeature &feature : features )
{
doActionForFeature( layer, features.at( idx ), point );
doActionForFeature( layer, feature, point );
}
} );
featureMenu->exec( position );
Expand Down

0 comments on commit cb19b34

Please sign in to comment.