-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Support multiple relation editors via relation widget registry #40721
Conversation
2c34643
to
51d920d
Compare
@suricactus A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
7c41f4e
to
01fd983
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Some remarks in the code.
The main remaining thing is to move away from using the deprecated methods, as @nyalldawson pointed out.
It might be nice to move all the files under src/gui/editorwidgets/relationeditor.
Regarding the naming of the classes:
- QgsRelationEditorWidget has been renamed to QgsRelationWidget
is this required? (but see after) - For the default widget, I am not a big fan of "basic". Shall we rather use default instead of basic?
- For the 2 abstract classes, the convention (or habit) in QGIS is to either use Abstract or Base in the name. So
QgsRelationEditorWidgetBase
andQgsRelationEditorConfigWidgetBase
?
…itorWidget" This reverts commit c3411b9. Since `addFeature()` has an argument, this should not be called directly
nice work! |
@suricactus |
Description
With this change the current relation editor is no longer the only way to edit relations. Similarly to the way different field editors exist, one can develop and register their own widget, using the newly added classes:
QgsRelationWidget
- the widget used in the attribute formQgsRelationConfigWidget
- the configuration widget shown in layer's attribute table configuration tabQgsRelationWidgetFactory
- a factory that creates theQgsRelationWidget
andQgsRelationConfigWidget
QgsRelationWidgetRegistry
- a registry where the factory is being registered.The currently existing
QgsRelationEditorWidget
is deprecated and replaced withQgsBasicRelationEditorWidget
, which is protected from accidentally being deleted and is used as fallback widget.The most notable UI change allows the user to select the desired relation widget from the drag n drop form configuration:
![image](https://user-images.githubusercontent.com/2820439/102889463-5e54d100-4463-11eb-9319-b9b0c33b0d9f.png)
Note the widget type and widget configuration UI.
Sample widget:
These changes are part of qgis/QGIS-Enhancement-Proposals#79 .
TODOs: