Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More efficient iteration
  • Loading branch information
nyalldawson committed Dec 10, 2020
1 parent 7f9ac7c commit c966ba7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/qgsmaptoolselectutils.cpp
Expand Up @@ -574,9 +574,12 @@ void QgsMapToolSelectUtils::QgsMapToolSelectMenuActions::populateChooseOneMenu(
QgsExpression exp = mVectorLayer->displayExpression();
exp.prepare( &context );

for ( QgsFeatureId id : qgis::as_const( displayedFeatureIds ) )
QgsFeatureRequest request = QgsFeatureRequest().setFilterFids( displayedFeatureIds );
QgsFeature feat;
QgsFeatureIterator featureIt = mVectorLayer->getFeatures( request );
while ( featureIt.nextFeature( feat ) )
{
QgsFeature feat = mVectorLayer->getFeature( id );
const QgsFeatureId id = feat.id();
context.setFeature( feat );

QString featureTitle = exp.evaluate( &context ).toString();
Expand Down

0 comments on commit c966ba7

Please sign in to comment.