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 int wrapMode: Text.NoWrap
14 property bool _noText: text === ""
15
16 QGCPalette { id:qgcPal; colorGroupEnabled: enabled }
17
18 indicator: Rectangle {
19 implicitWidth: ScreenTools.radioButtonIndicatorSize
20 implicitHeight: width
21 color: control.enabled ? "white" : "transparent"
22 border.color: qgcPal.buttonBorder
23 radius: height / 2
24 x: control.leftPadding
25 y: parent.height / 2 - height / 2
26
27 Rectangle {
28 anchors.fill: parent
29 color: qgcPal.buttonHighlight
30 opacity: control.hovered ? .2 : 0
31 radius: parent.radius
32 }
33
34 Rectangle {
35 anchors.centerIn: parent
36 // Width should be an odd number to be centralized by the parent properly
37 width: 2 * Math.floor(parent.width / 4) + 1
38 height: width
39 antialiasing: true
40 radius: height * 0.5
41 color: qgcPal.buttonHighlight
42 visible: control.checked
43 }
44 }
45
46 contentItem: Text {
47 text: control.text
48 font.family: control.font.pointSize
49 font.pointSize: control.font.pointSize
50 font.bold: control.font.bold
51 color: control.textColor
52 wrapMode: control.wrapMode
53 verticalAlignment: Text.AlignVCenter
54 leftPadding: control.indicator.width + (_noText ? 0 : ScreenTools.defaultFontPixelWidth * 0.25)
55 }
56
57}