7import QGroundControl.Controls
8import QGroundControl.FlyView
11 objectName: "preFlightCheckList"
12 spacing: 0.8 * ScreenTools.defaultFontPixelWidth
14 property real _verticalMargin: ScreenTools.defaultFontPixelHeight / 2
15 property Item _firstHeader: null ///< SectionHeader of the first group
16 readonly property real _headerLineGap: 2
20 source: "qrc:/qml/QGroundControl/FlyView/DefaultChecklist.qml"
23 property bool allChecksPassed: false
24 property bool prerequisitesPassed: true ///< Checks which must pass before this list's, such as the pre-vehicle checks
25 property var vehicleCopy: globals.activeVehicle
27 readonly property bool checklistPassed: allChecksPassed && prerequisitesPassed
29 onVehicleCopyChanged: {
30 if (checkListRepeater.model) {
31 checkListRepeater.model.reset()
35 onChecklistPassedChanged: {
36 if (checklistPassed) {
37 globals.activeVehicle.checkListState = Vehicle.CheckListPassed
39 globals.activeVehicle.checkListState = Vehicle.CheckListFailed
44 target: checkListRepeater.model
45 property: "prerequisitesPassed"
46 value: prerequisitesPassed
47 when: !!checkListRepeater.model
51 if (checkListRepeater.model) {
52 checkListRepeater.model.reset()
56 function groupPassedChanged() {
57 const model = checkListRepeater.model
61 model.updateGroupLocks()
62 allChecksPassed = model.isPassed()
65 //-- Pick a checklist model that matches the current airframe type (if any)
66 function _updateModel() {
67 var vehicle = globals.activeVehicle
69 vehicle = QGroundControl.multiVehicleManager.offlineEditingVehicle
72 if(vehicle.multiRotor) {
73 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/MultiRotorChecklist.qml"
74 } else if(vehicle.vtol) {
75 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/VTOLChecklist.qml"
76 } else if(vehicle.rover) {
77 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/RoverChecklist.qml"
78 } else if(vehicle.sub) {
79 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/SubChecklist.qml"
80 } else if(vehicle.fixedWing) {
81 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/FixedWingChecklist.qml"
83 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/DefaultChecklist.qml"
88 Component.onCompleted: {
93 if(globals.activeVehicle) {
100 // Zero-height row so the Reset button floats over the first group header's empty right side
102 Layout.fillWidth: true
103 Layout.preferredHeight: 0
104 Layout.bottomMargin: -parent.spacing
108 objectName: "preFlightCheckListResetButton"
110 anchors.right: parent.right
111 y: _firstHeader ? Math.max(0, _firstHeader.height - _firstHeader.bottomPadding - height - _headerLineGap) : 0
117 // All check list items
119 id: checkListRepeater
120 model: modelContainer.item.model
122 onItemAdded: (index, item) => {
123 if (index === 0 && item.headerItem) {
124 _firstHeader = item.headerItem
125 // Nothing precedes the first group, so drop the header's separation from the tab bar
126 _firstHeader.showSpacer = false
127 _firstHeader.topPadding = 0