import QtQuick, import org.qfield, import org.qgis ...
import QtQuick
Item {
[...]
}
Item, Rectangle, Text, TextInput, MouseArea, Dialog, ...
Text {
[...]
}
Item, Rectangle, Text, TextInput, MouseArea, Dialog, ...
Rectangle {
[...]
Text {
[...]
}
}
Item, Rectangle, Text, TextInput, MouseArea, Dialog, ...
Item {
[...]
Text {
[...]
}
}
Properties, Signals, Handlers and Methods
Rectangle {
...
MouseArea {
id: myArea
...
}
}
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
}
}
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
onClicked: ...
}
}
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
onClicked: parent.color = "red"
}
}
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
onClicked: { parent.color = "red" }
}
}
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
onClicked: myCustomMethod()
function myCustomMethod() {
parent.color = "red"
}
}
}
Properties, Signals, Handlers and Methods
Rectangle {
color: theColor
property var theColor: "green"
MouseArea {
anchors.fill: parent
onClicked: {
parent.theColor = "red"
}
}
}
Properties, Signals, Handlers and Methods
Rectangle {
color: theColor
property var theColor: "green"
MouseArea {
anchors.fill: parent
onClicked: {
if (theColor == "green") {
theColor = "red"
} else {
theColor = "green"
}
}
}
}
Properties, Signals, Handlers and Methods
Rectangle {
color: isGreen ? "red" : "green"
property bool isGreen: true
MouseArea {
anchors.fill: parent
onClicked: {
isGreen = !isGreen
}
}
}
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
onClicked: { parent.color = "red" }
}
}
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
signal colorChanged(var info)
MouseArea {
anchors.fill: parent
onClicked: {
parent.color = "red"
parent.colorChanged("by in the mouse area")
}
}
Text {
id: textFeedback
anchors.fill: parent
}
onColorChanged: {
textFeedback.text = "Color changed to:" + parent.color + " info:" + info;
}
}
import QtQuick 2.0
Text {
text: "Hello world!"
}
or here https://qmlweb.github.io
Go to: https://qmlweb.github.io
Modify it to change the text color on clicking on it.
… and optionally to change the color back with another click
Dashboard | Main menu | Search bar | Plugins toolbar | Positioning | Canvas actions

Dashboard | Main menu | Search bar | Plugins toolbar | Positioning | Canvas actions

Dashboard | Main menu | Search bar | Plugins toolbar | Positioning | Canvas actions

Dashboard | Main menu | Search bar | Plugins toolbar | Positioning | Canvas actions

Dashboard | Main menu | Search bar | Plugins toolbar | Positioning | Canvas actions

Dashboard | Main menu | Search bar | Plugins toolbar | Positioning | Canvas actions

iface
qgisProject
settings
clipboardManager
...
See QField API for class documentation for details on which classes are exposed.
iface.mainWindow()
iface.mapCanvas()
iface.positioning()
iface.findItemByObjectName("...")
iface.logMessage("...")
iface.addItemToPluginsToolbar()
iface.addItemToMainMenuActionsToolbar()
iface.addItemToCanvasActionsToolbar()
See QfAppInterface API documentation for details.
QfTheme.mainColor // #80cc28
QfTheme.mainTextColor
QfTheme.mainBackgroundColor
QfTheme.darkGray
QfTheme.defaultFont
QfTheme.getThemeVectorIcon("...")
See QfTheme API documentation for details.
import org.qfield.gui
...
QfButton
QfToolButton
QfTextField
QfSwitch
QfComboBox
...
See QML GUI Items for details.
QgsFeature
QgsGeometry
QgsAttributes
QgsPointXY
QgsField
...
See QGIS API documentation for class documentation.
import org.qfield.core
...
QfLayerUtils
QfGeometryUtils
QfFeatureUtils
QfCoordinateReferenceSystemUtils
QfSnappingUtils
...
See C++ core classes for details.




Popup on application display
iface.mainWindow.displayToast("")
Log message in the log panel
iface.logMessage("")
Console output (not visible in QField)
console.log("")
Rectangle{
id: myRectangle
parent: iface.mapCanvas()
anchors.fill: parent
color: '#5000ff00'
}
Let’s create a forecast plugin!
XmlHttpRequest to do an API call and fetch the forecast from open-meteo.comThe Java Script for using XmlHttpRequest
//Laax
const lat = 46.8053;
const lon = 9.2572;
let request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState === XMLHttpRequest.DONE) {
iface.logMessage(request.responseText)
}
}
request.open("GET", "https://api.open-meteo.com/v1/forecast?latitude=" + lat + "&longitude=" + lon + "&daily=weather_code,temperature_2m_max&timezone=auto");
request.send();
{
"0": {
"description": "Sunny",
"image": "http: //openweathermap.org/img/wn/01d@2x.png"
},
"1": {
"description": "Mainly Sunny",
"image": "http://openweathermap.org/img/wn/01d@2x.png"
},
[...]
};
Snap!

Nominatim locator plugin

LiveField plugin
QML Documentation https://doc.qt.io/qt-6/qtquick-index.html
QML Reference: https://doc.qt.io/qt-6/qmlreference.html
QML Tutorial: https://doc.qt.io/qt-6/qml-tutorial.html
Introduction to Qt/QML, by KDAB (YouTube Playlist)
QML online editor: https://qmlweb.github.io
QML advanced online editor: https://patrickelectric.work/qmlonline/
QField plugins: https://github.com/topics/qfield-plugin
QField documentation: https://api.qfield.org/
Plugin icons: https://fonts.google.com/icons
JavaScript online editor: https://runjs.app/play

Thanks, and happy coding!