[Qgis-developer] Qgis Api - select all features of a vector layer
b.rowlingson at lancaster.ac.uk
Tue Nov 9 11:46:19 EST 2010
On Tue, Nov 9, 2010 at 4:22 PM, kimaidou <kimaidou at gmail.com> wrote:
> Hi again
> Still working on my python plugin...
> I need to simply select all the features of a chosen vector layer. In
> QgsVectorLayer api, there is no method "selectAllFeatures()"
> So I use this piece of code to achieve it
That's an interesting approach! My selectplus plugin has a 'select
all' function which does this:
layer = self.iface.mapCanvas().currentLayer()
where layerIds is:
ids = 
p = layer.dataProvider()
allAttrs = p.attributeIndexes()
f = QgsFeature()
Your rectangle overlay should be pretty quick, but maybe my collecting
all the feature IDs is quicker?
More information about the Qgis-developer