Attribut-Eingabemaske¶
QField creates forms that are similar to QGIS, but with some differences. QGIS field widgets are supported on a best-effort basis and optimized for mobile use.
Attributtyp | Unterstützung | Notiz |
---|---|---|
Text Edit | - HTML is not supported - Numeric input is enforced based on the field type. |
|
Kontrollkästchen | ||
Werteabbildung | ||
Versteckt | ||
Anhang | This field is combined with camera integration. It is also able to open other files like pdf and doc (if you have an appropriate viewer) Attachment (photo settings) |
|
Datum Zeit | ||
Bereich | ||
Beziehungen | ||
Beziehungsreferenz | ||
Wertebeziehung | ||
UUID-Generator | ||
QML / HTML Widget | ||
Andere | Funding |
Attribute form configuration¶
In order to customize the attribute form, it is necessary to use the drag and drop designer in QGIS or to a use pre-written UI file. Like for QGIS you can make use of powerful expressions to populate the different fields. Additionally, to the ones available there are QFieldCloud specific variables, which can be utilized inside the attribute form.
Änderbar¶
Das Kennzeichen bearbeitbar von Feldern wird beachtet.
Letzte Werte erinnern¶
QField offers more fine-grained control over the last used values than QGIS, and uses its own settings instead of the QGIS ones.
Attribut-Eingabemasken unterdrücken¶
Die Einstellung Attribut-Eingabemaske unterdrücken wird direkt angewandt auf die QField-Eingabemaske.
Drag & Drop Designer Eingabemasken¶
Gruppen und Reiter von Drag and Drop Designer Eingabemasken werden unterstützt.
In the "Attributes Form," you can structure your forms using various containers, such as tabs and groups, and enhance interactivity by incorporating expression-based conditional visibility. By enabling the Drag and Drop Designer, you gain the flexibility to re-order attribute fields, as well as gaining access to widgets that are not directly tied to specific fields (e.g., HTML/QML widgets).
Ein Beziehungs-Widget konfigurieren¶
Vorbereitung am Schreibtisch
For detailed information on setting up layer relations in QGIS, please refer to the setting relations between multiple layers QGIS documentation. To further control the visibility and number of related items shown in QField, see the instructions for configuring Maximum items visibility for QField.
The relation widget shows all the referencing child features in a list. If enabled, it is possible to add, delete and open them.
The visual identification of the list entries is done via the Display Expression of the child layer.
Handhabung der Schlüssel¶
Since the parent primary key is used as foreign key in the referencing child features, the primary key must be safe to use (it must be unique) also after syncronizing back to the desktop. Therefore it is recommended to use UUIDs for primary keys. See [Working with Geopackages](../get-started/tutorials/advanced-setup-qfc/#working-with-geopackages for further information.
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.
Konfigurieren von Ordered-Beziehungen für QGIS und Standardwert¶
The Ordered Relation Editor widget allows the reordering of linked child features based on a specific field.
1. Installiere das Plugin¶
Stelle sicher, dass du das Plugin Ordered Relation Editor aus dem offiziellen Repository oder über den "Plugin Manager" in QGIS installiert hast.
2. Konfiguriere das Layout¶
Navigiere zum Abschnitt Attribut-Formular deiner Layer Einstellungen und stelle den Layout-Editor auf Drag and Drop Designer.
3. Das Beziehungs-Editor-Widget einrichten¶
In the Relation widget type dropdown, select Ordered Relation Editor. Then, configure the widget using the following settings:
-
Ordering Field: Specify the field in the child layer that will be used to determine the order of the features.
-
Description: Define an expression to be displayed for each child feature in the list.
-
Image Path (Optional): Provide a path to an image or icon to visually enhance the list. This is an expression that resolves dynamically.
Configuring an item threshold for Value Map Editor Widgets¶
Um die Benutzerfreundlichkeit von QField zu erhöhen, ist es möglich, den Schwellenwert für Elemente festzulegen, ab dem die Widgets des wertebasierten Karten-Editors auf eine Schaltfläche umschalten. Diese Funktion ermöglicht den schnellen Zugriff auf Elemente in QField, wenn nur wenige vorhanden sind, und bietet eine intuitivere Oberfläche, wenn eine große Anzahl von Elementen bearbeitet wird.
To activate the Toggle Button Interface:¶
-
Open Layer Properties by right-clicking on the desired layer and selecting 'Properties' from the menu.
-
Navigieren Sie zur Registerkarte QFeld im Dialogfeld Layer-Eigenschaften.
-
Hier finden Sie eine Option, mit der Sie die Anzahl der Elemente angeben können, die den Übergang zu einer Umschalttaste-Schnittstelle auslösen sollen. Geben Sie den gewünschten Schwellenwert entsprechend Ihren Bedürfnissen ein.
Configuring the Attachment Widget¶
Vorbereitung am Schreibtisch
The widget type Attachment is used with fields that store the path to files.
Es kann verwendet werden, um:
- Fotos anzeigen und aufnehmen oder Bilder aus der Galerie hinzufügen
- Zuhören und Aufnehmen von Soundclips
- Anhören und Aufnehmen von Videos
- Links zu externen Dateien wie PDFs oder Dokumenten anzeigen
The path should be set to relative. The pictures, audios, videos, pdf's and documents are stored then in a sub-directory of the project, where the link stored in the textfield is pointing to.
Anmerkung
QGIS 3.30 oder neuer ist für die Audio- und Video-Funktion nötig.
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's and documents has to be copied as well.
The option hyperlink on the attachment widget will disable the camera functionality and enable a hyperlink to open a document (pdf, doc, ...).
Konfigurierbarer Anhang-Pfad¶
Vorbereitung am Schreibtisch
QFieldSync bietet die Möglichkeit, den Pfad von Anhängen zu konfigurieren.
- Gehe zu QFieldSync Plugin > Layer-Eigenschaften
Verwenden Sie Ausdrücke, um den Pfad für die Anhänge anzugeben. Standardmäßig werden die Bilder im Ordner "DCIM", Audioaufnahmen werden im Ordner "Audio" und Videos im Ordner "Video" mit einem Zeitstempel als Namen gespeichert.
Konfigurieren Sie ein Wertrelations-Widget¶
Vorbereitung am Schreibtisch
Das Widget Wertrelation bietet Werte aus einer verwandten Tabelle in einer Combobox an. Sie können Layer, Schlüsselspalte und Wertspalte auswählen. Es sind mehrere Optionen verfügbar, um das Standardverhalten zu ändern: Nullwert zulassen, nach Wert ordnen und Mehrfachauswahl zulassen. Das Widget zeigt eine Dropdown- oder Mehrfachauswahlliste mit den referenzierten Merkmalen an.
Group Values in the Value Relation Widget¶
You can organize and optimize the appearance of your Value Relation widgets by grouping related items together. This feature allows you to categorize the values in a dropdown list or in a table view based on the content of a chosen column.
For example, if you have a list of cities, you can group them by their respective states. This makes it easier for users to navigate and find the values they need, especially in lists with a large number of items.
Konfiguration¶
Grouping is configured within the Value Relation widget's settings using the following options:
- Group column: Choose the column from the layer that will be used to organize the items. The values from this column will act as group title.
- Display group name: Check this box to display the group title as distinct header within the widget. This creates a clear separation between the different groups, making the list easier to navigate.
Konfigurieren der bedingten Sichtbarkeit¶
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 "disease" with the data type boolean. Only when the checkbox is checked, the list of diseases will be available to you.
In QField it will look like in the video below.
Beschränkungen definieren¶
Vorbereitung am Schreibtisch
Attribute fields can have constraints attached. Constraints are rules in the form of expressions. Before a feature can be saved all constraints need to be met. A description can be added that is shown if a constraint is not satisfied.
Ü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
Fields can have default values configured. Default values are inserted into the attribute form when digitizing a new feature. They are visible and can be modified as long as the field is editable.
Working with expressions¶
When creating expressions for projects intended to be used with QField, it is recommended to use layer names rather than layer IDs. This recommendation stems from the fact that during the project conversion process via QFieldSync, the resulting layers may receive different IDs, which can lead to incorrect expression evaluations. By using layer names, you ensure that expressions are evaluated consistently and accurately across different project states.
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 der Attribut-Eingabemaske 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
Falls ein neues Objekt ein Code entsprechend der Region, in der es digitalisiert wurde erhalten soll, kann dies mit einem aggregierten Ausdruck gemacht werden:
aggregate( layer:='regions', aggregate:='max', expression:="code", filter:=intersects( $geometry, geometry( @parent ) ) )
To transform the coordinates received from \@position_coordinate to the coordinate system of your project:
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'
)
)
In Wertbeziehungen und im Widget für Beziehungsreferenzen suchen¶
It is possible to search values 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
Auto-Vervollständigen Wert konfigurieren¶
Vorbereitung am Schreibtisch
The "Use completer" checkbox must be checked to be able to use the auto-complete in the value relation.
Here is a video showing how it works on QField
Definiere ein QML-Bedienelement¶
Benutzerdefinierte QML-Widgets können nützlich sein, um erweiterte Aktionen in Eingabemasken zu integrieren. In diesem Beispiel fügen wir eine Schaltfläche hinzu, die eine Karten- und Navigations-App eines Drittanbieters öffnet. Dies ist nützlich, um z. B. Turn-by-Turn-Navigationen auf der geräteeigenen App für den Benutzer zu öffnen.
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"));
}
}
Der obige URI 'geo
' ist für Android angepasst. Für Apple Maps kann die URI geändert werden in 'geo:' || $y || ',' || $x
.