New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix pasting features into vector layer from clipboard (fix #21154) #9065
Conversation
@alexbruy this is possibly an unreported issue (possibly even a regression), anyway I confirm the bug and will test the patch asap. |
This will fix the now reported issue https://issues.qgis.org/issues/21154 |
@alexbruy thanks for tackling this, I think I've run into this too in the past. |
Hi all, can anyone review this? To me seems to work ok. |
Looking at this now... |
@m-kuhn thanks! |
Is there any problem holding this from merging? |
IMHO it's up to @alexbruy to merge. review has been already done |
As said, I'll have a look at it soon, I'm working on this area currently. I'd be happy if you could hold back till the end of the week. |
ah ok, sorry, I just wanted to have this merged sooner than later to allow a wider testing on master (I know several users affected by this bug). |
ok, let's merge it for testing, I can also proceed with the updated codebase ;) |
Hi there, |
That's the issue which I was investigating and already existed in master before this patch. Are you sure this works in 3.4? |
ok, so is unrelated
yes, just tested (3.4.4 from osgeo4w) and linux. |
I do not think is related... the differente between feature.fields() and feature.attributes() is that the first is static the second not, but has been already parsed from clipboard |
Description
There are two layers (in my tests this is 1 shapefile and 1 geopackage). They have different tables, but the shapefile table is just a subset of the GPKG one meaning that the shape has columns with the same name and type of the GPKG. Copy/pasting from the SHP to GPKG results in only a few attributes to be copied.
Looks like this happens because
QgsVectorLayerUtils::matchAttributesToFields()
updates feature attributes while fields stay untouched. Later untouched fields are used to create attribute map for pasted feature leading to the data loss.Not sure that this is proper fix.
Checklist
fixes #11111
in the commit message next to the description[FEATURE]
in the commit message[needs-docs]
in the commit message and contain sufficient information in the commit message to be documentedscripts/prepare-commit.sh
script before each commit