QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCPitchIndicator.qml
Go to the documentation of this file.
1import QtQuick
2import QGroundControl
3import QGroundControl.Controls
4
5Rectangle {
6 property real pitchAngle: 0
7 property real rollAngle: 0
8 property real size: ScreenTools.isAndroid ? 300 : 100
9 property real _reticleHeight: 1
10 property real _reticleSpacing: size * 0.15
11 property real _reticleSlot: _reticleSpacing + _reticleHeight
12 property real _longDash: size * 0.35
13 property real _shortDash: size * 0.25
14 property real _fontSize: ScreenTools.defaultFontPointSize * 0.75
15
16 height: size
17 width: size
18 anchors.horizontalCenter: parent.horizontalCenter
19 anchors.verticalCenter: parent.verticalCenter
20 clip: true
21 Item {
22 height: parent.height
23 width: parent.width
24 Column{
25 anchors.horizontalCenter: parent.horizontalCenter
26 anchors.verticalCenter: parent.verticalCenter
27 spacing: _reticleSpacing
28 Repeater {
29 model: 36
30 Rectangle {
31 property int _pitch: -(modelData * 5 - 90)
32 anchors.horizontalCenter: parent.horizontalCenter
33 width: (_pitch % 10) === 0 ? _longDash : _shortDash
34 height: _reticleHeight
35 color: "white"
36 antialiasing: true
37 smooth: true
38 QGCLabel {
39 anchors.horizontalCenter: parent.horizontalCenter
40 anchors.horizontalCenterOffset: -(_longDash)
41 anchors.verticalCenter: parent.verticalCenter
42 smooth: true
43 font.bold: true
44 font.pointSize: _fontSize
45 text: _pitch
46 color: "white"
47 visible: (_pitch != 0) && ((_pitch % 10) === 0)
48 }
49 QGCLabel {
50 anchors.horizontalCenter: parent.horizontalCenter
51 anchors.horizontalCenterOffset: (_longDash)
52 anchors.verticalCenter: parent.verticalCenter
53 smooth: true
54 font.bold: true
55 font.pointSize: _fontSize
56 text: _pitch
57 color: "white"
58 visible: (_pitch != 0) && ((_pitch % 10) === 0)
59 }
60 }
61 }
62 }
63 transform: [ Translate {
64 y: (pitchAngle * _reticleSlot / 5) - (_reticleSlot / 2)
65 }]
66 }
67 transform: [
68 Rotation {
69 origin.x: width / 2
70 origin.y: height / 2
71 angle: -rollAngle
72 }
73 ]
74}