I am unclear on why one should use QgsFeatureRequest() when iterating over a file’s features.
Let’s say I would like to print out all IDs in my currently active dataset. Now, most examples will provide something like this:
lyr = iface.activeLayer() prov = lyr.dataProvider() for feature in prov.getFeatures(QgsFeatureRequest()): print feature.id()
Whereas the following, without referring to QgsFeatureRequest(), would yield the same result:
lyr = iface.activeLayer() prov = lyr.dataProvider() for feature in prov.getFeatures(): print feature.id()
I’d assume that the right way is using QgsFeatureRequest(), as most quality sources include it, but can someone explain what it actually does, and why one should use it?