QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
IntegratedCompassAttitude.qml
Go to the documentation of this file.
1import QtQuick
2
3import QGroundControl
4import QGroundControl.Controls
5import QGroundControl.FlyView
6import QGroundControl.FlightMap
7
8Item {
9 id: control
10 implicitWidth: (compassRadius * 2) + attitudeSpacing + attitudeSize
11 implicitHeight: implicitWidth
12
13 property alias attitudeSize: rollIndicator.attitudeSize
14 property alias attitudeSpacing: rollIndicator.attitudeSpacing
15 property real extraInset: attitudeSize + attitudeSpacing
16 property real extraValuesWidth: compassRadius
17 property real defaultCompassRadius: (mainWindow.width * 0.15) / 2
18 property real maxCompassRadius: ScreenTools.defaultFontPixelHeight * 7 / 2
19 property real compassRadius: Math.min(defaultCompassRadius, maxCompassRadius)
20 property real compassBorder: ScreenTools.defaultFontPixelHeight / 2
21 property var vehicle: globals.activeVehicle
22 property var qgcPal: QGroundControl.globalPalette
23 property bool usedByMultipleVehicleList: false
24
25 property real _totalAttitudeSize: attitudeSize + attitudeSpacing
26
27 IntegratedAttitudeIndicator {
28 id: rollIndicator
29 x: -_totalAttitudeSize
30 attitudeAngleDegrees: vehicle ? vehicle.roll.rawValue : 0
31 compassRadius: control.compassRadius
32 }
33
34 IntegratedAttitudeIndicator {
35 x: -_totalAttitudeSize
36 // Negated: rotating the indicator 90° clockwise moves its zero tick to the right of the
37 // compass but leaves the sweep direction clockwise, which would draw nose up as downward.
38 attitudeAngleDegrees: vehicle ? -vehicle.pitch.rawValue : 0
39 compassRadius: control.compassRadius
40 attitudeSize: control.attitudeSize
41 attitudeSpacing: control.attitudeSpacing
42 transformOrigin: Item.Center
43 rotation: 90
44 }
45
46 Rectangle {
47 y: _totalAttitudeSize
48 width: compassRadius * 2
49 height: width
50 radius: width / 2
51 color: qgcPal.window
52
53 QGCCompassWidget {
54 size: parent.width - compassBorder
55 vehicle: control.vehicle
56 usedByMultipleVehicleList: control.usedByMultipleVehicleList
57 anchors.centerIn: parent
58 }
59 }
60}