Bug report #13154
Feature count doesn't update
|Affected QGIS version:||2.10.0||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||not reproducable|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||21217|
When I add some items to the vector layer and then delete them then I run a script which looks in the vector layer and if the feature count is 0 it refills it again. but the problem is feature count is showing the previous features even though there is no feature in vector layer.
#1 Updated by Matthias Kuhn about 5 years ago
From the script you have open in the background it looks as if you are adding features directly on the provider, bypassing the layer (Using layer.dataProvider().addFeatures() instead of layer.addFeature() with startEditing() / commitChanges() ).
This way you change the data directly on the provider and bypass the internal mechanism to update gui elements (like canvas, attribute table) in sync and metadata like feature count may be wrong.