[Qgis-developer] setSubsetOfAttributes() doean't work?

Alexander Bruy alexander.bruy at gmail.com
Mon May 13 00:50:32 PDT 2013


Hi all,

I try to get features within some rectangle, and want to get only 
some attributes without geometries. So I use next code:

request = QgsFeatureRequest()
request.setFilterRect(self.extent)
request.setFlags(QgsFeatureRequest.NoGeometry)
request.setSubsetOfAttributes([0, 3, 6])
f = QgsFeature()
fit = layer.getFeatures(request)
while fit.nextFeature(f):
  attrs = f.attributes()
  # process attributes
  ...

but in attrs valiable I always get *all* feature attributes. Is this
bug or maybe I miss something?

Thanks,
-- 
Alexander Bruy


More information about the Qgis-developer mailing list