Attributformular¶
QField erstellt Formulare ähnlich, aber nicht gleich zu QGIS. Die Feldattribut von QGIS werden nach bestem Wissen und Gewissen unterstützt und für den mobilen Einsatz optimiert.
Attributtyp | Unterstützung | Notiz |
---|---|---|
Text Edit | - HTML wird nicht unterstützt - Die numerische Eingabe ist abhängig vom Typ. |
|
Kontrollkästchen | ||
Werteabbildung | ||
Versteckt | ||
Anhang | Dieses Feld ist mit der Kameraintegration kombiniert. Es ist auch in der Lage, andere Dateien wie pdf und doc zu öffnen (wenn Sie einen entsprechenden Viewer haben) Anhang (Fotoeinstellungen) | |
Datum Zeit | ||
Bereich | ||
Beziehungen | ||
Beziehungsreferenz | ||
Wertebeziehung | ||
UUID-Generator | ||
QML / HTML Widget | ||
Andere | Funding |
Änderbar¶
The editable flag of fields is respected.
Letzte Werte erinnern¶
QField bietet eine viel genauere Kontrolle über die zuletzt verwendeten Werte und ignoriert die QGIS-Einstellung.
Suppress attribute form¶
The setting suppress attribute form is directly applied to the QField form.
Drag and Drop Designer Formulare¶
Gruppen und Reiter von Drag and Drop Designer Formularen werden unterstützt.
Configure a Relation Widget¶
Desktop Vorbereitung
For more information refer to the relations chapter of the official QGIS Documentation.
The relation widget shows all the referencing child features in a list. It is possible to add, delete and open them.
The visual identification of the list entries are done via the Display Expression of the child layer.
Key handling¶
Since the parents primary keys are used as foreign keys on the referencing child features, these primary keys must be save to use even after the synchronization back to the original data. Therefore we recommend to use stable values such as UUIDs for primary keys.
It is possible to already add children from a parent that is about to be added. This possibility will be blocked if there is no valid primary key on the parent or the constraints are violated. In case the adding of the parent feature is canceled after some children have been added already, the children are deleted as well.
Viele-zu-viele Beziehungen¶
On many-to-many relationships, according to the cardinality setting in the QGIS Vector Layer Properties, on adding, deleting or opening an entry in the list effects directly the child layer (on direct cardinality) or the linking table (on many-to-one cardinality).
The second case is usually used when there are additional relation information (e.g. percentage) in the linking table.
In case of the many-to-one cardinality on many-to-many relations the Display Expression needs to be set on the linking table.
Configure Attachment Widget¶
Desktop Vorbereitung
Der Bedienelementtyp Anhang wird für Felder verwendet, die den Pfad zu Dateien speichern.
Es kann verwendet werden, um:
- show and take photos or add pictures from the gallery
- listen and record sound clips
- show and record videos
- show links to external files like PDFs or documents
The path should be set to relative. The pictures, audios, videos, pdf and docs are stored then in a sub-directory of the project, where the link stored in the textfield is pointing to.
Note
QGIS 3.30 or newer is required for the audio and video functionality
In QField the attachments are displayed. By clicking the icons symbol the camera or audio record is started to update the pictures, videos or audios with a new media.
On synchronization the sub-directory with the pictures, videos audios, pdf and docs has to be copied as well.
Die Option Hyperlink im Bedienelement Anhang deaktiviert die Kamerafunktion und aktiviert einen Hyperlink zum Öffnen eines Dokuments (pdf, doc, ...).
Configurable attachment path¶
Vorbereitung am Schreibtisch
QFieldSync provides the possibility to configure the path of attachments.
- Go to QFieldSync plugin > Layers Properties
Use expressions to specify the path of the attachments. By default, pictures are saved into the "DCIM" folder, audio recordings are saved into the "audio" folder and videos are saved into "video" with a timestamp as name.
Configure a Value Relation Widget¶
Vorbereitung am Schreibtisch
The widget Value Relation offers values from a related table in a combobox. You can select layer, key column and value column. Several options are available to change the standard behaviors: allow null value, order by value and allow multiple selections. The widget will display a drop-down or multiple-select list of the referenced features.
Configure Conditional Visibility¶
Vorbereitung am Schreibtisch
Groups can be hidden based on an expression. This is useful when certain attributes are only required under certain conditions. As an example imagine mapping trees. Some of them might have a disease and you have a list of possible deseases. To not clutter the form with many fields, make a group and configure a visibility expression for a group "diseases". Add a field "desease" with a checkbox. Only when the checkbox is checked, the list of diseases will be available to you.
Let's see what we got on the field:
Beschränkungen definieren¶
Vorbereitung am Schreibtisch
Attributfelder können mit Beschränkungen versehen werden. Beschränkungen sind Ausdrücke, die zu wahr
(oder 1
) ausgewertet werden müssen, um um das Formular speichern zu können. Beschränkungen werden für jedes Feld einzeln konfiguriert
und es kann eine Beschreibung hinzugefügt werden, die angezeigt wird, wenn eine Beschränkung nicht erfüllt ist.
Übliche Anwendungsfälle¶
Du kannst keinen Höhenwert eingeben, der höher ist als der höchste Berg in diesem Land.
"elevation" < 5000
Es ist nötig, eine Bezeichnung einzugeben.
"identifier" IS NOT NULL
Definiere Vorgabewerte¶
Vorbereitung am Schreibtisch
Für Felder können Vorgabewerte eingestellt werden. Die Vorgabewerte werden in das Attributformular eingefügt, wenn ein neues Feld angelegt wird. Sie sind sichtbar und können geändert werden, solange das Feld bearbeitbar ist. Sie können auf der Geometrie oder auf Ausdrucksvariablen basieren.
Zusätzliche Variablen¶
For more information regarding storing information related to your position in object attributes, refer to the deticated GNSS documentation.
Für QFieldCloud-Benutzer können zwei Variablen in Ausdrücken verwendet werden, die die Standardwerte des Attributformulars enthalten:
- @cloud_username
gibt den Namen des aktuell eingeloggten QFieldCloud-Benutzers aus.
- @cloud_useremail
gibt die E-Mailadresse der aktuell eingeloggten QFieldCloud-Benutzers aus.
Übliche Anwendungsfälle¶
Positionsinformationen als Variable einbinden:
@position_horizontal_accuracy
Aktuelles Datum und Zeit einfüllen.
now()
Die Länge der digitalisierten Linie einfügen:
length($geometry)
Globale Variablen auf dem Gerät konfigurieren und verwenden.
@operator_name
Wenn du einen Regionalcode basierend auf dem Ort zuweisen möchtest, an dem ein neues Objekt eingefügt wird, kannst du dies mit einem Aggregatausdruck tun:
aggregate( layer:='regions', aggregate:='max', expression:="code", filter:=intersects( $geometry, geometry( @parent ) ) )
So transformierst du die von \@position_coordinate erhaltenen Koordinaten in das Koordinatensystem deines Projektes:
x(transform(@position_coordinate, 'EPSG:4326', @project_crs ))
y(transform(@position_coordinate, 'EPSG:4326', @project_crs ))
::: {#snapping_results} If you want to use the snapping results after drawing a line, you can use the [\@snapping_results]{.title-ref} variable. The following code extracts the value of the attribute [id]{.title-ref} of the snapping match of the first point of a line. :::
with_variable(
'first_snapped_point',
array_first( @snapping_results ),
attribute(
get_feature_by_id(
@first_snapped_point['layer'],
@first_snapped_point['feature_id']
),
'id'
)
)
Search in value relation and relation reference widget¶
It is possible to search value in a value relation or relation reference widget using the magnifying glass next to the field.
Note
Define the display expression for the concerned layers, this will be used for searching for features. This is configured under Vector Layer Properties > Display
Configure Auto-complete Value¶
Vorbereitung am Schreibtisch
The "Use completer" checkbox must be checked to be able to use the auto-complete in the value relation.
Here a video showing how it works on QField
Definiere ein QML-Bedienelement¶
Custom QML widgets can be useful to integrate advanced actions into forms. In this example we define add a button that open a third-party map and navigation app. This is useful to open e.g. turn-by-turn navigations on the device-native app for the user.
import QtQuick 2.0
import QtQuick.Controls 2.0
Button {
width: 200
height: width/5
text: "Open in Maps"
onClicked: {
Qt.openUrlExternally(expression.evaluate("'geo:0,0?q=' || $y || ',' || $x"));
}
}
The geo
URI above is adapted to work with Android. For Apple Maps the URI can be changed to 'geo:' || $y || ',' || $x
.