Bug report #21304
"default value" is not applied when pasting features
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | Alessandro Pasotti | ||
Category: | Edit widget | ||
Affected QGIS version: | 3.5(master) | Regression?: | Yes |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 29122 |
Description
In QGIS master the "default value" for a field is not applied when pasting a new feature.
It works ok (as usual) for new digitized features.
Does not affects 3.4.4
Steps:
1) set a default value for a field of a vector
2) digitize a new feature, do not fill the column where the default was set > default is applied
3) copy a feature from another layer and paste it in the layer with the default (the source layer must not have a filled field that can possibly fill the equivalent field in the target layer) > default is not applied
Associated revisions
Also check for nulls when applying defaults
isValid is not enough because fields are initialized with
QVariant(field.type()) which is valid but null.
Fixes #21304
With test
History
#1 Updated by Alessandro Pasotti almost 6 years ago
- Assignee set to Alessandro Pasotti
#2 Updated by Alessandro Pasotti almost 6 years ago
- Status changed from Open to Feedback
I cannot reproduce, can you attach a sample project and data?
#3 Updated by Giovanni Manghi almost 6 years ago
- File test1.zip added
- File Recording #3.mp4 added
Screencast and project attached (datasources are gpkg, but is the same for different ones).
#4 Updated by Alessandro Pasotti almost 6 years ago
- Status changed from Feedback to In Progress
Fix is in https://github.com/qgis/QGIS/pull/9203
#5 Updated by Alessandro Pasotti almost 6 years ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
Applied in changeset qgis|bf1575f4c9aca6c550f6d0711bd3297adfbb27b2.