-
Notifications
You must be signed in to change notification settings - Fork 0
/
GPSWidget.qml
58 lines (55 loc) · 1.39 KB
/
GPSWidget.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtPositioning 5.12
Item{
id: root
implicitHeight: row.height
implicitWidth: row.width
property string label: 'Longitude\tLatitude'
property string stringvalue: '\t'
signal reset()
PositionSource {
id: src
updateInterval: 1000
active: true
onPositionChanged: {
var coord = src.position.coordinate;
if(coord.isValid){
lat.text = coord.longitude.toFixed(4);
lon.text = coord.latitude.toFixed(4);
root.stringvalue = coord.longitude.toFixed(6)+'\t'+coord.latitude.toFixed(6)+'\t';
}
else {
lat.text = '---';
lon.text = '---';
}
}
}
Row{
id: row
spacing: 5
Label{
text: "GPS "
anchors.verticalCenter: parent.verticalCenter
}
TextField {
id: lat
width: 100
enabled: false
placeholderText: ("Latitude")
text: "---"
}
Label {
id: label7
text: qsTr("/")
anchors.verticalCenter: parent.verticalCenter
}
TextField {
id: lon
width: 100
enabled: false
placeholderText: ("Longitude")
text: "---"
}
}
}