-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Keep attributes when adding 1-N related features with a multi-edition attribute form #58223
base: master
Are you sure you want to change the base?
Conversation
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
Hi there, The end customer is concerned that the initial anomaly may return to the LTR. Can we move forward on Jacky's proposal @nyalldawson @nirvn? |
Anyone else more available can have a look? @3nids (since you commented here #57474 (comment)) maybe? |
I'll try to have a look today |
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
Hello Mathieu, Did you make it? |
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
Description
The bug is described in this PR, which has been merged, and reverted recently.
Therefore, the bug is back again.
In this PR I want to discuss the right way to fix the bug (and propose an approach), and decide if we should fix it, or if we should re-think the behavior because the UX might be wrong.
The bug
Context
We have a layer A (say buildings - Point) with a 1-N relation with layer B (say pictures - No geometry, one field for file path).
Each building can have multiple pictures.
Intent
The user wants to add the same picture to many (say 4) buildings.
UX
It's possible with QGIS, and we see in the code that the intent is to create 4 identical picture features and reference them to each building.
Bug
Only one (the first) of the new picture features have the correct attributes:
Cause of the bug
The first picture feature is added with
QgsVectorLayerTools::addFeatureV2()
inQgsGuiVectorLayerTool
implementation, which delegates the feature addition toQgsFeatureAction::addFeature()
, which delegates the feature addition toQgsVectorLayerUtils::createFeature()
and the attribute formQgsAttributeForm::featureSaved
, etc.In this process, the attributes are set asynchronously through signals.
It means that when the user writes the file path in his new picture feature attribute, the other 3 picture features have already been added (without attributes, copied from the bare first picture feature).
AddFeatureResult::Pending
)Should it be even possible?
This kind of use-case might raise the question: "Maybe I need an N-M relation? One picture can be related to more than one building, and one building can be related to more than one picture."
So should QGIS really give the user the possibility to multi-edit a building to add a child feature on a 1-N relation?
Fix the bug
I first fixed the bug by making the add-a-child-popup modal, but it created a regression.
Ways to fix:
ping @nyalldawson @nirvn @Guts