-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.qml
34 lines (28 loc) · 843 Bytes
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import QtQuick
import QtQuick.Controls
import org.qfield
import org.qgis
import Theme
Item {
id: plugin
property var mainWindow: iface.mainWindow()
property var positionSource: iface.findItemByObjectName('positionSource')
Component.onCompleted: {
iface.addItemToPluginsToolbar(pluginButton)
}
QfToolButton {
id: pluginButton
iconSource: 'icon.svg'
iconColor: Theme.mainColor
bgcolor: Theme.darkGray
round: true
onClicked: {
let position = positionSource.positionInformation
if (positionSource.active && position.latitudeValid && position.longitudeValid) {
mainWindow.displayToast(qsTr('Your current position is ' + position.latitude + ', ' +position.longitude))
} else {
mainWindow.displayToast(qsTr('Your current position is unknown'))
}
}
}
}