コンテンツにスキップ

属性情報フォーム

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.

ウィジェットタイプ サポートの可否 備考
テキスト編集 - HTML is not supported
- Numeric input is enforced based on the field type.
チェックボックス
バリューマップ
非表示
アタッチメント 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)
日付/時刻
レンジ
リレーションの参照
リレーションウィジェット
値のリレーション
UUIDジェネレーター
QML / HTMLウィジェット
その他 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.

編集可否

フィールドの編集可能フラグが優先されます。

最後の値を記憶する

QField offers more fine-grained control over the last used values than QGIS, and uses its own settings instead of the QGIS ones.

属性フォームの抑制

属性フォームの抑制設定は、QFieldフォームに直接適用されます。

ドラッグアンドドロップデザイナーフォーム

ドラッグアンドドロップデザイナーフォームでのグループとタブの設定はサポートされます。

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).

リレーションウィジェットを設定する

デスクトップの準備

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.

キーの処理

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.

多対多のリレーション

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).

通常、2番目のケースは、リンクしているテーブルに追加の関係情報(パーセンテージなど)がある場合に使用されます。

In case of the many-to-one cardinality on many-to-many relations the Display Expression needs to be set on the linking table.

Configuring Ordered Relations for QGIS and QField

The Ordered Relation Editor widget allows the reordering of linked child features based on a specific field.

1. Install the Plugin

Make sure you have installed the Ordered Relation Editor plugin from the official repository or through the "Plugin Manager" in QGIS.

2. Configure the Layout

Navigate to the Attributes Form section of your layer settings and set the layout editor to Drag and Drop Designer.

3. Set Up the Relation Editor Widget

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.

Widget configuration in QGIS
Widget configuration in QGIS

QField
QField

Configuring an item threshold for Value Map Editor Widgets

To enhance the user experience within QField, it is possible to control the item threshold at which point the value map editor widgets switch to a toggle buttons interface. This feature allows users to quickly access items in QField when there are few and providing a more intuitive interface when dealing with a large number of items.

To activate the Toggle Button Interface:

  1. Open Layer Properties by right-clicking on the desired layer and selecting 'Properties' from the menu.

  2. Navigate to the QField tab located within the Layer Properties dialog.

  3. Here, you will find an option to specify the quantity of items that will trigger the transition to a toggle button interface. Enter the preferred threshold value according to your needs.

QFieldSync Layer Properties
QFieldSync Layer Properties

QField Value Map Editor as List
QField Value Map Editor as List

QField Value Map Editor as Buttons
QField Value Map Editor as Buttons

Configuring the Attachment Widget

デスクトップの準備

The widget type Attachment is used with fields that store the path to files.

次のようなことに利用できます:

  • 写真を表示して撮影したり、ギャラリーから写真を追加する
  • サウンドクリップを聴き、録音する
  • ビデオの表示と録画
  • PDFや書類のような外部ファイルのリンクを表示

フォーム添付画像
フォーム添付画像

フォーム添付オーディオ
フォーム添付オーディオ

フォーム添付ビデオ
フォーム添付ビデオ

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.

備考

オーディオおよびビデオ機能には、QGIS 3.30以降が必要です。

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, ...).

写真のパスの設定

デスクトップの準備

QFieldSyncを使うことで添付するパスの設定が可能になります。

  • _QFieldSync プラグイン > レイヤプロパティ_へと進みます

添付ファイルのパスを指定するには、式を使用します。デフォルトでは、画像は "DCIM "フォルダに、音声は "audio "フォルダに、動画は "video "に、タイムスタンプを名前として保存されます。

パス
パス

値リレーションウィジェットを設定する

デスクトップの準備

ウィジェットの値のリレーションはコンボボックスで関連づけられたテーブルからの値を参照することを可能にします。レイヤキーカラム値カラムを選択できます。標準の動作を変えるいくつかのオプションーNULL値を許容する値で並べ替える複数選択を許容するーがあります。このウィジェットは参照する地物のドロップダウンリストか複数選択リストで表示されます。

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.

構成

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.

First configuration
First configuration

Second configuration
Second configuration

Third configuration
Third configuration

Different configurations on QField
Different configurations on QField

条件付き表示の設定をする

デスクトップの準備

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.

Configuration of a group box that will only be shown if the checkbox "desease" is checked.
Configuration of a group box that will only be shown if the checkbox "desease" is checked.

In QField it will look like in the video below.

制約の設定をする

デスクトップの準備

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.

レンジ内での制約の設定
レンジ内での制約の設定

一般的な使用例

この国で最も標高が高い山よりも大きな標高値を入力することはできません。

"elevation" < 5000

identifier は入力必須の項目です。

"identifier" IS NOT NULL

初期値の定義

デスクトップの準備

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.

Using layer names in expressions
Using layer names in expressions

追加の変数

For more information regarding storing information related to your position in object attributes, refer to the deticated GNSS documentation.

QFieldCloudユーザは、属性フォームのデフォルト値を含む式で2つの変数を使用できます: - @cloud_username: これは、現在ログインしているQFieldCloudユーザーの名前を返します。 - @cloud_useremail: これは、現在ログインしているQFieldCloudユーザーのメールアドレスを返します。

一般的な使用例

位置情報を変数として挿入します。

@position_horizontal_accuracy

現在の日付と時間を挿入します。

now()

デジタイズした線分の長さを挿入します。

length($geometry)

デバイス上のグローバル変数を構成し挿入します。

@operator_name

新しい地物が挿入される場所に基づいて地域コードを割り当てる場合は、集計式を使用して割り当てることができます。

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'
  )
)

値リレーション・リレーション参照ウィジェットでの検索

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

オートコンプリートの設定

デスクトップの準備

The "Use completer" checkbox must be checked to be able to use the auto-complete in the value relation.

Enable auto-complete within QGIS
Enable auto-complete within QGIS

Here is a video showing how it works on QField

QMLウィジェットを定義する

この例では、サードパーティの地図・ナビゲーションアプリを開くボタンを追加します。これは、例えばturn-by-turnのナビゲーションをデバイスネイティブアプリで開くのに便利です。

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"));
    }
}

上記の geo URIはAndroidで動作するように調整されています。Apple Mapsの場合、URIは'geo:' || $y || ',' || $xに変更できます。