Bug report #7072
regression : can't create a feature
Status: | Closed | ||
---|---|---|---|
Priority: | Severe/Regression | ||
Assignee: | - | ||
Category: | Vectors | ||
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 #: | 16156 |
Description
In master revision (94491b8),
it seems impossible to create a feature with geometry: the new object disappears after its creation.
Thanks all
Associated revisions
History
#1 Updated by Nathan Woodrow almost 12 years ago
We are going to need some more information then that in order to track down the issue. What type of layer are you using?
#2 Updated by Philippe Dorelon almost 12 years ago
- File test.zip added
In fact, the bug appears when there is a join on the edited layer. I tested it with shape files, spatialite files on points and lines.
#3 Updated by Philippe Dorelon almost 12 years ago
I think the problem is in qgsvectorlayereditbuffer.cpp : QgsVectorLayerEditBuffer::addFeature
This lines :
int layerFieldCount = L->dataProvider()->fields().count() + mAddedAttributes.count() - mDeletedAttributeIds.count();
if ( layerFieldCount != f.attributes().count() )
return false;
f.attributes().count()
includes joinfields
, layerFieldCount
doesn't.
With something like that, it works:
int layerFieldJoinCount=0;
for ( int i = 0; i < L->mUpdatedFields.count(); ++i )
{
if ( L->mUpdatedFields.fieldOrigin(i)==QgsFields::OriginJoin )
{
layerFieldJoinCount++;
}
}
int layerFieldCount = L->dataProvider()->fields().count() + layerFieldJoinCount + mAddedAttributes.count() - mDeletedAttributeIds.count();
#4 Updated by Denis Rouzaud over 11 years ago
Does it make sense to have all joined fields in the edit form as they won't be used?
#5 Updated by Denis Rouzaud over 11 years ago
Should be fixed by these two requests:
https://github.com/qgis/Quantum-GIS/pull/576
https://github.com/qgis/Quantum-GIS/pull/546
Reply from Minoru:
I think it's right. In 1.8, joined fields are editable. Input values
are displayed in the attribute table, but their values are not saved
when I save the layer as a new file.
My patch1 does not hide joined fields in new feature form, but it
makes joined fields uneditable. As soon as we create a new feature on
join layer, fields in the joined table are bind to the new feature
corresponding to the value of the target field. I believe that editing
join layer should work well with two patches1[2].
#6 Updated by Nathan Woodrow over 11 years ago
What is the status of this?
#7 Updated by Nathan Woodrow over 11 years ago
- Status changed from Open to Closed
Fixed in changeset aca3dfaf77a227e95c67a5dabbe67887b30a53fe.