Commit 80ce7ae0 authored by Stefan Dunca's avatar Stefan Dunca

custom-example: Add GPS info to the Vehicle Indicator

parent f6e72014
...@@ -266,68 +266,59 @@ Item { ...@@ -266,68 +266,59 @@ Item {
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
columns: 7 columns: 7
anchors.centerIn: parent anchors.centerIn: parent
//-- Chronometer //-- Latitude
QGCColoredImage { QGCLabel {
height: _indicatorsHeight height: _indicatorsHeight
width: height width: height
source: "/custom/img/chronometer.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text color: qgcPal.text
text: "lat:"
} }
QGCLabel { QGCLabel {
text: { id: firstLabel
if(activeVehicle) text: activeVehicle ? activeVehicle.gps.lat.value.toFixed(activeVehicle.gps.lat.decimalPlaces) : "-"
return secondsToHHMMSS(activeVehicle.getFact("flightTime").value)
return "00:00:00"
}
color: _indicatorsColor color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignLeft
} }
//-- Ground Speed //-- Longitude
QGCColoredImage { QGCLabel {
height: _indicatorsHeight height: _indicatorsHeight
width: height width: height
source: "/custom/img/horizontal_speed.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text color: qgcPal.text
text: "lon:"
} }
QGCLabel { QGCLabel {
text: activeVehicle ? activeVehicle.groundSpeed.value.toFixed(1) + ' ' + activeVehicle.groundSpeed.units : "0.0" text: activeVehicle ? activeVehicle.gps.lon.value.toFixed(activeVehicle.gps.lon.decimalPlaces) : "-"
color: _indicatorsColor color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: Text.AlignRight horizontalAlignment: firstLabel.horizontalAlignment
} }
//-- Vertical Speed //-- HDOP
QGCColoredImage { QGCLabel {
height: _indicatorsHeight height: _indicatorsHeight
width: height width: height
source: "/custom/img/vertical_speed.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text color: qgcPal.text
text: "HDOP:"
} }
QGCLabel { QGCLabel {
text: activeVehicle ? activeVehicle.climbRate.value.toFixed(1) + ' ' + activeVehicle.climbRate.units : "0.0" text: activeVehicle ? activeVehicle.gps.hdop.value.toFixed(activeVehicle.gps.hdop.decimalPlaces) : "-"
color: _indicatorsColor color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: Text.AlignRight horizontalAlignment: firstLabel.horizontalAlignment
} }
//-- Compass //-- Compass
Item { Item {
Layout.rowSpan: 2 Layout.rowSpan: 3
Layout.minimumWidth: mainIsMap ? parent.height * 1.25 : 0 Layout.minimumWidth: mainIsMap ? parent.height * 1.25 : 0
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
...@@ -395,6 +386,66 @@ Item { ...@@ -395,6 +386,66 @@ Item {
} }
} }
//-- Second Row //-- Second Row
//-- Chronometer
QGCColoredImage {
height: _indicatorsHeight
width: height
source: "/custom/img/chronometer.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text
}
QGCLabel {
text: {
if(activeVehicle)
return secondsToHHMMSS(activeVehicle.getFact("flightTime").value)
return "00:00:00"
}
color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: firstLabel.horizontalAlignment
}
//-- Ground Speed
QGCColoredImage {
height: _indicatorsHeight
width: height
source: "/custom/img/horizontal_speed.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text
}
QGCLabel {
text: activeVehicle ? activeVehicle.groundSpeed.value.toFixed(1) + ' ' + activeVehicle.groundSpeed.units : "0.0"
color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: firstLabel.horizontalAlignment
}
//-- Vertical Speed
QGCColoredImage {
height: _indicatorsHeight
width: height
source: "/custom/img/vertical_speed.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text
}
QGCLabel {
text: activeVehicle ? activeVehicle.climbRate.value.toFixed(1) + ' ' + activeVehicle.climbRate.units : "0.0"
color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: firstLabel.horizontalAlignment
}
//-- Third Row
//-- Odometer //-- Odometer
QGCColoredImage { QGCColoredImage {
height: _indicatorsHeight height: _indicatorsHeight
...@@ -412,7 +463,7 @@ Item { ...@@ -412,7 +463,7 @@ Item {
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: Text.AlignRight horizontalAlignment: firstLabel.horizontalAlignment
} }
//-- Altitude //-- Altitude
QGCColoredImage { QGCColoredImage {
...@@ -431,7 +482,7 @@ Item { ...@@ -431,7 +482,7 @@ Item {
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: Text.AlignRight horizontalAlignment: firstLabel.horizontalAlignment
} }
//-- Distance //-- Distance
QGCColoredImage { QGCColoredImage {
...@@ -450,7 +501,7 @@ Item { ...@@ -450,7 +501,7 @@ Item {
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: Text.AlignRight horizontalAlignment: firstLabel.horizontalAlignment
} }
} }
MouseArea { MouseArea {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment