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 spacing: 0
25
26 Repeater {
27 model: battParams.getBatteryCount()
28
29 delegate: ColumnLayout {
30 required property int index
31 spacing: 0
32 visible: _monitorEnabled
33
34 property string _prefix: battParams.prefixForIndex(index)
35 property string _label: battParams.labelForIndex(index)
36 property Fact _monitor: controller.getParameterFact(-1, _prefix + "MONITOR")
37 property bool _monitorEnabled: _monitor.rawValue !== 0
38 property bool _capacityAvailable: controller.parameterExists(-1, _prefix + "CAPACITY")
39 property Fact _capacity: _capacityAvailable ? controller.getParameterFact(-1, _prefix + "CAPACITY") : null
40
41 VehicleSummaryRow {
42 labelText: qsTr("Batt%1 monitor").arg(_label)
43 valueText: _monitor.enumStringValue
44 }
45
46 VehicleSummaryRow {
47 labelText: qsTr("Batt%1 capacity").arg(_label)
48 valueText: _capacity ? _capacity.valueString + " " + _capacity.units : ""
49 visible: _capacityAvailable
50 }
51 }
52 }
53 }
54}