Skip to content
Permalink
Browse files

iterate through features with iterator

  • Loading branch information
signedav committed Oct 25, 2018
1 parent 5bcff46 commit cb19b346552522b051798de10ad9c75f28493767
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/app/qgsmaptoolfeatureaction.cpp
@@ -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 );

0 comments on commit cb19b34

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