File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -258,9 +258,6 @@ void QgsFieldCalculator::accept()
258
258
bool calculationSuccess = true ;
259
259
QString error;
260
260
261
- bool onlySelected = mOnlyUpdateSelectedCheckBox ->isChecked ();
262
- QgsFeatureIds selectedIds = mVectorLayer ->selectedFeaturesIds ();
263
-
264
261
bool useGeometry = exp.needsGeometry ();
265
262
int rownum = 1 ;
266
263
@@ -271,17 +268,14 @@ void QgsFieldCalculator::accept()
271
268
if ( newField )
272
269
emptyAttribute = QVariant ( field.type () );
273
270
274
- QgsFeatureIterator fit = mVectorLayer ->getFeatures ( QgsFeatureRequest ().setFlags ( useGeometry ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) );
271
+ QgsFeatureRequest req = QgsFeatureRequest ().setFlags ( useGeometry ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry );
272
+ if ( mOnlyUpdateSelectedCheckBox ->isChecked () )
273
+ {
274
+ req.setFilterFids ( mVectorLayer ->selectedFeaturesIds () );
275
+ }
276
+ QgsFeatureIterator fit = mVectorLayer ->getFeatures ( req );
275
277
while ( fit.nextFeature ( feature ) )
276
278
{
277
- if ( onlySelected )
278
- {
279
- if ( !selectedIds.contains ( feature.id () ) )
280
- {
281
- continue ;
282
- }
283
- }
284
-
285
279
expContext.setFeature ( feature );
286
280
expContext.lastScope ()->setVariable ( QString ( " row_number" ), rownum );
287
281
You can’t perform that action at this time.
0 commit comments