QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCArtificialHorizon.qml
Go to the documentation of this file.
1import QtQuick
2
3Item {
4 id: root
5 property real rollAngle : 0
6 property real pitchAngle: 0
7 clip: true
8 anchors.fill: parent
9
10 property real angularScale: pitchAngle * root.height / 45
11
12 Item {
13 id: artificialHorizon
14 width: root.width * 4
15 height: root.height * 8
16 anchors.centerIn: parent
17 Rectangle {
18 id: sky
19 anchors.fill: parent
20 smooth: true
21 antialiasing: true
22 gradient: Gradient {
23 GradientStop { position: 0.25; color: Qt.hsla(0.6, 1.0, 0.25) }
24 GradientStop { position: 0.5; color: Qt.hsla(0.6, 0.5, 0.55) }
25 }
26 }
27 Rectangle {
28 id: ground
29 height: sky.height / 2
30 anchors {
31 left: sky.left;
32 right: sky.right;
33 bottom: sky.bottom
34 }
35 smooth: true
36 antialiasing: true
37 gradient: Gradient {
38 GradientStop { position: 0.0; color: Qt.hsla(0.25, 0.5, 0.45) }
39 GradientStop { position: 0.25; color: Qt.hsla(0.25, 0.75, 0.25) }
40 }
41 }
42 transform: [
43 Translate {
44 y: angularScale
45 },
46 Rotation {
47 origin.x: artificialHorizon.width / 2
48 origin.y: artificialHorizon.height / 2
49 angle: -rollAngle
50 }]
51 }
52}