QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCRadioButton.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3
4import QGroundControl
5import QGroundControl.Controls
6
7RadioButton {
8 id: control
9 font.family: ScreenTools.normalFontFamily
10 font.pointSize: ScreenTools.defaultFontPointSize
11
12 property color textColor: qgcPal.text
13 property bool _noText: text === ""
14
15 QGCPalette { id:qgcPal; colorGroupEnabled: enabled }
16
17 indicator: Rectangle {
18 implicitWidth: ScreenTools.radioButtonIndicatorSize
19 implicitHeight: width
20 color: control.enabled ? "white" : "transparent"
21 border.color: qgcPal.buttonBorder
22 radius: height / 2
23 x: control.leftPadding
24 y: parent.height / 2 - height / 2
25
26 Rectangle {
27 anchors.fill: parent
28 color: qgcPal.buttonHighlight
29 opacity: control.hovered ? .2 : 0
30 radius: parent.radius
31 }
32
33 Rectangle {
34 anchors.centerIn: parent
35 // Width should be an odd number to be centralized by the parent properly
36 width: 2 * Math.floor(parent.width / 4) + 1
37 height: width
38 antialiasing: true
39 radius: height * 0.5
40 color: qgcPal.buttonHighlight
41 visible: control.checked
42 }
43 }
44
45 contentItem: Text {
46 text: control.text
47 font.family: control.font.pointSize
48 font.pointSize: control.font.pointSize
49 font.bold: control.font.bold
50 color: control.textColor
51 verticalAlignment: Text.AlignVCenter
52 leftPadding: control.indicator.width + (_noText ? 0 : ScreenTools.defaultFontPixelWidth * 0.25)
53 }
54
55}