QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
APMPowerComponentSummary.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import QGroundControl
6import QGroundControl.FactControls
7import QGroundControl.Controls
8
9Item {
10 implicitWidth: mainLayout.implicitWidth
11 implicitHeight: mainLayout.implicitHeight
12 width: parent.width // grows when Loader is wider than implicitWidth
13
14 FactPanelController { id: controller }
15
16 APMBatteryParams {
17 id: battParams
18 controller: controller
19 batteryIndex: 0
20 }
21
22 ColumnLayout {
23 id: mainLayout
24 width: parent.width
25 spacing: 0
26
27 Repeater {
28 model: battParams.getBatteryCount()
29
30 delegate: ColumnLayout {
31 Layout.fillWidth: true
32 required property int index
33 spacing: 0
34 visible: _monitorEnabled
35
36 property string _prefix: battParams.prefixForIndex(index)
37 property string _label: battParams.labelForIndex(index)
38 property Fact _monitor: controller.getParameterFact(-1, _prefix + "MONITOR")
39 property bool _monitorEnabled: _monitor.rawValue !== 0
40 property bool _capacityAvailable: controller.parameterExists(-1, _prefix + "CAPACITY")
41 property Fact _capacity: _capacityAvailable ? controller.getParameterFact(-1, _prefix + "CAPACITY") : null
42
43 VehicleSummaryRow {
44 labelText: qsTr("Batt%1 monitor").arg(_label)
45 valueText: _monitor.enumStringValue
46 }
47
48 VehicleSummaryRow {
49 labelText: qsTr("Batt%1 capacity").arg(_label)
50 valueText: _capacity ? _capacity.valueString + " " + _capacity.units : ""
51 visible: _capacityAvailable
52 }
53 }
54 }
55 }
56}