QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
JoystickComponentButtonMonitor.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Dialogs
4import QtQuick.Layouts
5
6import QGroundControl
7import QGroundControl.Controls
8import QGroundControl.VehicleSetup
9import QGroundControl.FactControls
10
11Flow {
12 spacing: ScreenTools.defaultFontPixelWidth
13
14 property var _joystick: joystickManager.activeJoystick
15
16 QGCPalette { id: qgcPal }
17
18 Connections {
19 target: _joystick
20
21 onRawButtonPressedChanged: (index, pressed) => {
22 if (buttonRepeater.itemAt(index)) {
23 buttonRepeater.itemAt(index).pressed = pressed
24 }
25 }
26 }
27
28 Repeater {
29 id: buttonRepeater
30 model: _joystick.buttonCount
31
32 Rectangle {
33 implicitWidth: ScreenTools.defaultFontPixelHeight * 1.5
34 implicitHeight: width
35 border.width: 1
36 border.color: qgcPal.text
37 color: pressed ? qgcPal.buttonHighlight : qgcPal.button
38
39 property bool pressed
40
41 QGCLabel {
42 anchors.fill: parent
43 color: pressed ? qgcPal.buttonHighlightText : qgcPal.buttonText
44 horizontalAlignment: Text.AlignHCenter
45 verticalAlignment: Text.AlignVCenter
46 text: modelData
47 }
48 }
49 }
50}