QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VehicleRotationCal.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3
4import QGroundControl
5import QGroundControl.Controls
6
7Rectangle {
8 id: root
9
10 // Calibration state of the orientation shown by this control.
11 // Values must stay in sync with SensorsComponentController::SideCalState.
12 enum CalState {
13 Idle, ///< No calibration data to show (neutral preview)
14 Incomplete, ///< Calibration running, this orientation not yet calibrated
15 InProgress, ///< This orientation actively being calibrated
16 Completed ///< This orientation calibration complete
17 }
18
19 property int calState: VehicleRotationCal.CalState.Idle
20
21 // Text to show while calibration is in progress
22 property string calInProgressText: qsTr("Hold Still")
23
24 // Image source
25 property var imageSource: ""
26
27 color: qgcPal.text
28
29 states: [
30 State {
31 name: "idle"
32 when: root.calState === VehicleRotationCal.CalState.Idle
33 PropertyChanges {
34 root.color: qgcPal.text
35 statusLabel.text: ""
36 }
37 },
38 State {
39 name: "incomplete"
40 when: root.calState === VehicleRotationCal.CalState.Incomplete
41 PropertyChanges {
42 root.color: "red"
43 statusLabel.text: qsTr("Incomplete")
44 }
45 },
46 State {
47 name: "inProgress"
48 when: root.calState === VehicleRotationCal.CalState.InProgress
49 PropertyChanges {
50 root.color: "yellow"
51 statusLabel.text: root.calInProgressText
52 }
53 },
54 State {
55 name: "completed"
56 when: root.calState === VehicleRotationCal.CalState.Completed
57 PropertyChanges {
58 root.color: "green"
59 statusLabel.text: qsTr("Completed")
60 }
61 }
62 ]
63
64 QGCPalette { id: qgcPal; colorGroupEnabled: root.enabled }
65
66 Rectangle {
67 readonly property int inset: 5
68
69 x: inset
70 y: inset
71 width: parent.width - (inset * 2)
72 height: parent.height - (inset * 2)
73 color: qgcPal.windowShade
74
75 Image {
76 width: parent.width
77 height: parent.height
78 source: root.imageSource
79 fillMode: Image.PreserveAspectFit
80 smooth: true
81 }
82
83 QGCLabel {
84 id: statusLabel
85 width: parent.width
86 height: parent.height
87 horizontalAlignment: Text.AlignHCenter
88 verticalAlignment: Text.AlignBottom
89 font.pointSize: ScreenTools.mediumFontPointSize
90 }
91 }
92}