Skip to content

Commit fa625ff

Browse files
committedOct 25, 2018
use forward declaration for QgsFeature
and use as_const on featurelist
1 parent cb19b34 commit fa625ff

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎src/app/qgsmaptoolfeatureaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y )
138138
else
139139
{
140140
QMenu *featureMenu = new QMenu();
141-
for ( const QgsFeature &feature : features )
141+
for ( const QgsFeature &feature : qgis::as_const( features ) )
142142
{
143143
QAction *featureAction = featureMenu->addAction( FID_TO_STRING( feature.id() ) );
144144
connect( featureAction, &QAction::triggered, this, [ = ] { doActionForFeature( layer, feature, point );} );
145145
}
146146
QAction *allFeatureAction = featureMenu->addAction( tr( "All Features" ) );
147147
connect( allFeatureAction, &QAction::triggered, this, [ = ]
148148
{
149-
for ( const QgsFeature &feature : features )
149+
for ( const QgsFeature &feature : qgis::as_const( features ) )
150150
{
151151
doActionForFeature( layer, feature, point );
152152
}

‎src/app/qgsmaptoolfeatureaction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
#include "qgis.h"
2020
#include "qgsmaptool.h"
21-
#include "qgsfeature.h"
2221

2322
#include <QObject>
2423
#include <QPointer>
2524
#include "qgis_app.h"
2625

2726
class QgsVectorLayer;
27+
class QgsFeature;
2828

2929
/**
3030
\brief Map tool for running feature actions on the current layer

0 commit comments

Comments
 (0)
Please sign in to comment.