6import QGroundControl.Controls
7import QGroundControl.FactControls
9// Camera calculator "Camera" section for mission item editors
13 property var cameraCalc
15 property real _margin: ScreenTools.defaultFontPixelWidth / 2
16 property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5
17 property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
19 Component.onCompleted: {
20 cameraBrandCombo.selectCurrentBrand()
21 cameraModelCombo.selectCurrentModel()
24 QGCPalette { id: qgcPal; colorGroupEnabled: true }
27 Layout.fillWidth: true
32 Layout.fillWidth: true
33 model: cameraCalc.cameraBrandList
34 onModelChanged: selectCurrentBrand()
35 onActivated: (index) => { cameraCalc.cameraBrand = currentText }
39 function onCameraBrandChanged() { cameraBrandCombo.selectCurrentBrand() }
42 function selectCurrentBrand() {
43 currentIndex = cameraBrandCombo.find(cameraCalc.cameraBrand)
49 Layout.fillWidth: true
50 model: cameraCalc.cameraModelList
51 visible: !cameraCalc.isManualCamera && !cameraCalc.isCustomCamera
52 onModelChanged: selectCurrentModel()
53 onActivated: (index) => { cameraCalc.cameraModel = currentText }
57 function onCameraModelChanged() { cameraModelCombo.selectCurrentModel() }
60 function selectCurrentModel() {
61 currentIndex = cameraModelCombo.find(cameraCalc.cameraModel)
65 // Camera based grid ui
67 Layout.fillWidth: true
69 visible: !cameraCalc.isManualCamera
72 Layout.alignment: Qt.AlignHCenter
74 visible: !cameraCalc.fixedOrientation.value
77 width: _editFieldWidth
79 checked: !!cameraCalc.landscape.value
80 onClicked: cameraCalc.landscape.value = 1
84 id: cameraOrientationPortrait
86 checked: !cameraCalc.landscape.value
87 onClicked: cameraCalc.landscape.value = 0
91 // Custom camera specs
94 Layout.fillWidth: true
96 enabled: cameraCalc.isCustomCamera
99 Layout.fillWidth: true
102 Item { Layout.fillWidth: true }
104 Layout.preferredWidth: _root._fieldWidth
108 Layout.preferredWidth: _root._fieldWidth
114 Layout.fillWidth: true
117 QGCLabel { text: qsTr("Sensor"); Layout.fillWidth: true }
119 Layout.preferredWidth: _root._fieldWidth
120 fact: cameraCalc.sensorWidth
123 Layout.preferredWidth: _root._fieldWidth
124 fact: cameraCalc.sensorHeight
129 Layout.fillWidth: true
132 QGCLabel { text: qsTr("Image"); Layout.fillWidth: true }
134 Layout.preferredWidth: _root._fieldWidth
135 fact: cameraCalc.imageWidth
138 Layout.preferredWidth: _root._fieldWidth
139 fact: cameraCalc.imageHeight
144 Layout.fillWidth: true
147 text: qsTr("Focal length")
148 Layout.fillWidth: true
151 Layout.preferredWidth: _root._fieldWidth
152 fact: cameraCalc.focalLength