
–v–

–v–
| PROJECT PLUGINS | APPLICATION PLUGINS |
|---|---|
| Shared alongside QField project | Shared via URL (ZIP file) |
| Single plugin | Multiple plugins |
| Installation not required | Required installation |
| Lasts project session | Lasts QField session |
–v–
–v–
Item, Rectangle, Text, TextInput, MouseArea, Dialog, ...
Text {
[...]
}
–v–
Item, Rectangle, Text, TextInput, MouseArea, Dialog, ...
Rectangle {
[...]
Text {
[...]
}
}
–v–
Item, Rectangle, Text, TextInput, MouseArea, Dialog, ...
Item {
[...]
Text {
[...]
}
}
–v–
Properties, Signals, Handlers and Methods
Rectangle {
...
MouseArea {
id: myArea
...
}
}
–v–
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
}
}
–v–
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
onClicked: ...
}
}
–v–
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
onClicked: parent.color = "red"
}
}
--v--
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
onClicked: { parent.color = "red" }
}
}
–v–
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
onClicked: myCustomMethod()
function myCustomMethod() {
parent.color = "red"
}
}
}
–v–
Properties, Signals, Handlers and Methods
Rectangle {
color: theColor
property var theColor: "green"
MouseArea {
anchors.fill: parent
onClicked: {
parent.theColor = "red"
}
}
}
–v–
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"
}
}
}
}
–v–
Properties, Signals, Handlers and Methods
Rectangle {
color: isGreen ? "red" : "green"
property bool isGreen: true
MouseArea {
anchors.fill: parent
onClicked: {
isGreen = !isGreen
}
}
}
–v–
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
MouseArea {
anchors.fill: parent
onClicked: { parent.color = "red" }
}
}
–v–
Properties, Signals, Handlers and Methods
Rectangle {
color: "green"
signal colorChanged(info: string)
MouseArea {
anchors.fill: parent
onClicked: {
parent.color = "red"
parent.colorChanged("by in the mouse area")
}
}
onColorChanged: {
console.log("Color changed to:", parent.color, " info:", info)
}
}
–v–
–v–
–v–
import QtQuick 2.0
Text {
text: "Hello world!"
}
or here https://qmlweb.github.io
–v–
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
–v–
Dashboard | Main menu | Search bar | Plugins toolbar | Positioning | Canvas actions

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

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

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

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

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

–v–
iface
qgisProject
settings
clipboardManager
...
See qgismobileapp.cpp for details.
–v–
iface.mainWindow()
iface.mapCanvas()
iface.findItemByObjectName("...")
iface.logMessage("...")
iface.addItemToPluginsToolbar()
iface.addItemToMainMenuActionsToolbar()
iface.addItemToCanvasActionsToolbar()
See appinterface.h for details.
–v–
Theme.mainColor // #80cc28
Theme.mainTextColor
Theme.mainBackgroundColor
Theme.darkGray
Theme.defaultFont
Theme.getThemeVectorIcon("...")
See Theme.qml for details.
–v–
QfButton
QfToolButton
QfTextField
QfSwitch
QfComboBox
...
See src/qml/imports/Theme/* for details.
–v–
QgsFeature
QgsGeometry
QgsAttributes
QgsPointXY
QgsField
...
See qgismobileapp.cpp::initDeclarative for details.
–v–
LayerUtils
GeometryUtils
FeatureUtils
CoordinateReferenceSystemUtils
SnappingUtils
...
See src/core/utils/* for details.
–v–

–v–


–v–

–v–

–v–
Check out the main.qml in the plugin directory.
import QtQuick
Item {
Component.onCompleted: {
iface.mainWindow().displayToast('First demo!')
}
}
–v–
Popup on application display
mainWindow.displayToast("")
Log message in the log panel
iface.logMessage("")
Console output (not visible in QField)
console.log("")
–v–
Rectangle{
id: myRectangle
parent: iface.mapCanvas()
anchors.fill: parent
color: '#5000ff00'
}
–v–
https://github.com/opengisch/qfield-template-plugin
–v–
Let’s create a forecast plugin!
–v–
XmlHttpRequest to do an API call and fetch the forecast from open-meteo.com–v–
–v–
The Java Script for using XmlHttpRequest
//Norrköping
lat = 58.5833;
lon = 16.1833;
let request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState === XMLHttpRequest.DONE) {
console.log(request.response)
}
}
request.open("GET", "https://api.open-meteo.com/v1/forecast?latitude=" + lat + "&longitude=" + lon + "&daily=weather_code,temperature_2m_max&timezone=auto");
request.send();
–v–
{
"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"
},
[...]
};
–v–
Snap!

–v–
Nominatim locator plugin

–v–
LiveField plugin
QML Docu 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
Plugin icons: https://fonts.google.com/icons
JavaScript online editor: https://runjs.app/play

Thanks, and happy coding!