Skip to content

Commit

Permalink
use forward declaration for QgsFeature
Browse files Browse the repository at this point in the history
and use as_const on featurelist
  • Loading branch information
signedav committed Oct 25, 2018
1 parent cb19b34 commit fa625ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolfeatureaction.cpp
Expand Up @@ -138,15 +138,15 @@ bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y )
else
{
QMenu *featureMenu = new QMenu();
for ( const QgsFeature &feature : features )
for ( const QgsFeature &feature : qgis::as_const( features ) )
{
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 ( const QgsFeature &feature : features )
for ( const QgsFeature &feature : qgis::as_const( features ) )
{
doActionForFeature( layer, feature, point );
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolfeatureaction.h
Expand Up @@ -18,13 +18,13 @@

#include "qgis.h"
#include "qgsmaptool.h"
#include "qgsfeature.h"

#include <QObject>
#include <QPointer>
#include "qgis_app.h"

class QgsVectorLayer;
class QgsFeature;

/**
\brief Map tool for running feature actions on the current layer
Expand Down

0 comments on commit fa625ff

Please sign in to comment.