Skip to content

Instantly share code, notes, and snippets.

@signedav
Last active July 31, 2018 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save signedav/2939ece6d4bc274a005179c4ea73dac2 to your computer and use it in GitHub Desktop.
Save signedav/2939ece6d4bc274a005179c4ea73dac2 to your computer and use it in GitHub Desktop.
QField Relation Editor Widget

Relation Editor Widget on QField

Here are the use cases and how the relation editor widget could look in qfield with the different behavior for one-to-many and many-to-many relationships.

1:N Relations

The childfeatures are listed. In any case, the delete icons is black *1. This means the child features will be deleted.

list_1

By pressing on the feature the "embedded" Form pops up:

edit_referenced_feature

By pressing on the + the form for creating a feature appears (same style like "embedded" popup):

add_referenced_feature

N:M Relations on Many-to-Many Cardinality

The referenced features are listed.

list_2

It's always an association, so the delete icons are only blue. This means only the reference (entry in the referencetable) is deleted and the related feature still existing.

Anyway because of the many-to-many cardinality is set, on pressing on the feature the "embedded" form of the related feature (not the referencetableentry) pops up:

edit_referenced_feature

By pressing on the + the form for linking a feature pops up:

link_feature

You can select the feature you want to link in the combobox:

link_feature_2

Or by pressing + you can add a new feature. The form for creating a feature pops up:

add_referenced_feature

N:M Relations with attributes of reference

In case there are attributes on the reference there should be possible to display it with display expressions in the list:

list_4

This means in the configuration the cardinality should not be set to many-to-many because we are interested in the referencetable.

Pressing on the feature a form opens where we can set the values of the referencetableentry and selecting another related feature.

link_feature_with_referenceattribute.png

On pressing the + the same form opens but a new relation is created on selecting the feature.

By pressing the + the addform opens like we are used to:

add_referenced_feature

Optional implementations

Add and edit

On N:M Relations with attributes of reference there could be on editing the referencetableentry the possibilty to add a new related feature as well and on adding a new referencetableentry the possibility to edit a related feature as well. So there could be two buttons or another GUI sollution:

add and edit

By pressing then the edit-icon the editform opens like we are used to:

edit_referenced_feature

Select feature

This approach works well with a small amount (e.g. < 100) of selectable features. If they are more it needs to be more confortable to find it. There are two approach:

  • Search function
  • List all the selectable features in scrollable list

Both approaches can be imagined like the contacts on usual android:

contacts

RelationStrength

On 1:N relations in QGIS exist the relation strengths "association" and "composition". The composition should mean, that the child features are depending on the parent -> so get deleted on "unlinking". On association they would still be on their lable.

At the moment, it's implemented like a composition. The child features would be deleted on delete.

In case the relation is an association, the delete icons could be blue as well. This means only the reference is deleted and the child feature still existing.

list_association

But composition is anyway prefered. Because otherwise you got "lost" childs.

Swipe View

Instead of the list view there could be a swipe view where QField recognizes an image widget. So the user could swipe between the images and add new ones using the camera or delete one.

swipe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment