Bug report #10560
Wrong feature count after edit
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||18967|
- Open a vector layer
- Right-click on the layer from layer tree and enable Feature count (the number of features is correct at this stage)
- Toggle editing
- Add or delete features (number of features is still correct)
- Save edits
Feature count resets to the original number
The bug is not in 2.2
Repack shapefiles when saving after deleting features
- QgsVectorDataProvider::dataChanged() will be emitted
- QgsVectorLayer::dataChanged() will be emitted
- Clears QgsVectorLayerCache
- Reloads the attribute table
- Clears the selection
Looking forward to people complaining about their lost selection...
#9 Updated by Steve Lowman over 4 years ago
- Status changed from Closed to Reopened
I tested it in 2.8.2. The bug still exists.
I paste a couple of copied features into the layer. The count changes from 0 to 2. All good so far.
I save the change. The count stays at 2. All correct still.
I delete one of the features. The count reduces to 1. Still good.
I save the change. The count changes back to 2. Oh dear, not so good.
#15 Updated by Steve Lowman over 3 years ago
Yep, I'm in W10. How to reproduce this...
1. New project file.
2. New shapefile layer.
3. Check 'Show Feature Count' for new layer.
4. 'Add Features' tool, digitise some features, e.g. 2 features. (Feature Count updates correctly - reads '2').
5. Save Layer Edits. (Feature Count stays correct - reads '2').
6. Digitise one more feature, and save layer edits. (Feature Count still correct - reads '3').
7. Select and delete one of your features. (Feature Count reduces correctly - reads '2').
8. Save Layer Edits. (Feature Count incorrectly reverts to previous value - reads '3').
#18 Updated by Andreas Neumann over 3 years ago
- File qgis-rel-dev.png added
I just tested this with a shapefile on Windows 7 with QGIS 2.15 (master) and QGIS 2.14 (#843d17e ) and aren't able to reproduce this issue.
@Reinhard and/or Steve: can you please test with #843d17e - you can install it using the OSGeo4W installer (http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe) by chosing "QGIS Rel Dev" in the "Desktop" section.