Skip to content
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

Use a read-only line edit instead of combobox in relation reference doesn't allow to add a child from the parent #42813

Closed
rbovard opened this issue Apr 15, 2021 · 3 comments · Fixed by #43509
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Forms Relations

Comments

@rbovard
Copy link

rbovard commented Apr 15, 2021

Describe the bug
Use a read-only line edit instead of combobox in relation reference doesn't allow to add a child from the parent

How to Reproduce

  1. Consider having 2 tables (parent and child)
  2. Create a relation between them (Project - Propreties - Relations)
  3. Open propreties of child layer and go to the Attributes Form panel
  4. Set the widget type as Relation Reference
  5. Check the Use a read-only line edit instead of combobox
  6. Ok
  7. Add a new feature in parent
  8. When doing this, add a new child feature
  9. Bug --> The field of the parent is empty

If in 5. we do not check Use a read-only line edit instead of combobox, the 9. is fine (we have the (id) of the parent in the field)

QGIS and OS versions

QGIS version
3.16.5-Hannover
QGIS code revision
58ba7c1ed6
Compiled against Qt
5.11.2
Running against Qt
5.11.2
Compiled against GDAL/OGR
3.1.4
Running against GDAL/OGR
3.1.4
Compiled against GEOS
3.8.1-CAPI-1.13.3
Running against GEOS
3.8.1-CAPI-1.13.3
Compiled against SQLite
3.29.0
Running against SQLite
3.29.0
PostgreSQL Client Version
11.5
SpatiaLite Version
4.3.0
QWT Version
6.1.3
QScintilla2 Version
2.10.8
Compiled against PROJ
6.3.2
Running against PROJ
Rel. 6.3.2, May 1st, 2020
OS Version
Windows 10 (10.0)
Active python plugins
actions_for_relations; 
geomapfish_locator; 
quick_map_services; 
db_manager; 
processing
@rbovard rbovard added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Apr 15, 2021
@3nids
Copy link
Member

3nids commented Jun 1, 2021

This one is not an easy fix.

When we create a feature from the relation editor, it sets the attribute of the foreign key. But the new feature in the parent layer does not exist yet.
This works well with the combobox which handles yet unregistered values.

The read-only line edit does not support this.
We could implement this, but I am not sure it is worth the effort.

The read-only line edit was added while we didn't have the background loading combobox with completer (we only had a classic combobox, which could cause troubles when you had many entries).

💣 I would rather propose to drop the read-only line edit. 💥

@rbovard would that suit your needs?
@m-kuhn we discussed about it in the past, any more thoughts?

@rbovard
Copy link
Author

rbovard commented Jun 1, 2021

Hi @3nids, thanks for the analysis.

Okay for your proposition to drop the Use a read-only line edit instead of combobox.

@m-kuhn
Copy link
Member

m-kuhn commented Jun 1, 2021

We could also keep the option and disable the dropdown (that means to keep an option where we still allow on map identification but disable the dropdown), I think sometimes the lineedit was used to get this kind of UX when it was not possible to create a meaningful text.

3nids added a commit to 3nids/QGIS that referenced this issue Jun 2, 2021
keep the read-only config and make the drop-down read-only instead

fixes qgis#42813
3nids added a commit that referenced this issue Jun 2, 2021
keep the read-only config and make the drop-down read-only instead

fixes #42813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Forms Relations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants