Bug report #9268
Attribute table not updating automatically
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||17882|
1. Open any vector layer and toggle editing mode;
2. Open field calculator and create new field using function "$rownum" for example - all works fine;
3. Don't save changes and try to update field from previous step with new value - column values not updating automatically
4. Stop editing and save changes for see new values.
Always emit signal when attribute values change
- Remove QgsVectorLayer::blockSignals() calls from QgsFieldCalculator
- Deprecate emitSignal parameter from QgsVectorLayer::changeAttributeValue( fid, field, value, emitSignal )
- Code cleanup to update calls to the new emitSignal-less method
#1 Updated by Matthias Kuhn over 6 years ago
I am a bit puzzled about this issue.
It would be an easy fix (remove the blockSignals calls on lines 192 and 194 in qgsfieldcalculator.cpp) but then, the call to mVectorLayer->changeAttributeValue specifies the parameter
false for emitSignal, and therefore tries to actively suppress the communication channel to the attribute table. There would be two reasons for this
- mActiveIterator got closed (see #7071) but this issue is no longer existent as we now are able to have multiple iterators open
- Performance issues (A signal being emitted for every feature on the layer, possibly heavy operation)? If this is the case, maybe there are better ways to deal with this.
My opinion would be, that the emitSignal parameter (which does not work anyway) needs to be removed and signals should not be blocked, as this prevents proper reactions to attribute changes. If there are performance issues (which I didn't read of, so I have no proof for these) we have to find another solution.