Using QGIS 2.4 python console, I'm trying to display only a subset of a layer features. I've managed to get the features both from the layer :
featuresIterator = layer.getFeatures(QgsFeatureRequest().setFilterExpression ( u'"field"=4'))
and from the dataProvider :
featuresIterator = layer.dataProvider().getFeatures(QgsFeatureRequest().setFilterExpression ( u'"field"=4'))
(I'm not sure to understand the difference).
What I want to achieve now is to display only these features. In the exact same way as one would do using the query builder from the GUI. I don't know whether this has to be managed at the level of render (which would render some features and not others), or at the level of the data provider (which would only provide the layer with a view on the data containing only the wanted subset), or somewhere in between.