Hi Dev's,

having a small dataset of 300 features (from an online service).

I want to quickly remove most/all of those features, request a new set an put them in the same vectorlayer (in a python plugin).

All ok, untill you activate the 'show feature count' in the legend.

If you show the featurecount, it looks like the features are deleted one by one: you can see the featurecount go down to zero... ( but I also have dataset with a lot more features :-( ) and it takes several (ten's) seconds.

Easy testable:

- load some data, tick the 'show feature count' tickbox in the legend.
- make the layer editable and select all features
- make sure the layer is current in the legend

do the following in the python console:

l=iface.mapCanvas().currentLayer()
l.deleteSelectedFeatures()

you can see the 'feature count' go down one by one (slowly...)

while... if you do it outside of python, using the little red delete-basket in the edit-toolbar. All features are deleted in a blink! Also if you show the featurecount...

I tried some different ways, but could not find a quick way?

Do I miss something/a quicker way?

I thought that it maybe had something to do with filling up the 'editbuffer', so tried with and without the 'edit' construct [0]
But in this case I just do not want an edit-buffer anyway..

Regards,

Richard Duivenvoorde


[0] http://www.opengis.ch/2015/08/12/with-edit-layer/#avoid-using-dataprovider-methods
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to