14 changed files with 46 additions and 161 deletions
@ -1,56 +1,46 @@ |
|||||||
import QtQuick 2.3 |
import QtQuick 2.11 |
||||||
import QtQuick.Controls 1.2 |
import QtQuick.Controls 2.4 |
||||||
import QtQuick.Controls.Styles 1.4 |
import QtQuick.Controls.Styles 1.4 |
||||||
|
|
||||||
import QGroundControl.Palette 1.0 |
import QGroundControl.Palette 1.0 |
||||||
import QGroundControl.ScreenTools 1.0 |
import QGroundControl.ScreenTools 1.0 |
||||||
|
|
||||||
RadioButton { |
RadioButton { |
||||||
|
id: control |
||||||
property color textColor: _qgcPal.text |
property color textColor: _qgcPal.text |
||||||
property bool textBold: false |
property bool textBold: false |
||||||
property real textFontPointSize: ScreenTools.defaultFontPointSize |
property real textFontPointSize: ScreenTools.defaultFontPointSize |
||||||
|
|
||||||
property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } |
property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } |
||||||
|
|
||||||
property bool _noText: text === "" |
property bool _noText: text === "" |
||||||
|
|
||||||
activeFocusOnPress: true |
|
||||||
|
|
||||||
style: RadioButtonStyle { |
|
||||||
spacing: _noText ? 0 : ScreenTools.defaultFontPixelWidth * 0.25 |
|
||||||
|
|
||||||
label: Item { |
|
||||||
implicitWidth: _noText ? 0 : text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25 |
|
||||||
implicitHeight: _noText ? 0 : Math.max(text.implicitHeight, ScreenTools.radioButtonIndicatorSize) |
|
||||||
baselineOffset: text.y + text.baselineOffset |
|
||||||
|
|
||||||
Text { |
|
||||||
id: text |
|
||||||
text: control.text |
|
||||||
font.pointSize: textFontPointSize |
|
||||||
font.bold: control.textBold |
|
||||||
color: control.textColor |
|
||||||
anchors.centerIn: parent |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
indicator: Rectangle { |
indicator: Rectangle { |
||||||
width: ScreenTools.radioButtonIndicatorSize |
implicitWidth: ScreenTools.radioButtonIndicatorSize |
||||||
height: width |
implicitHeight: width |
||||||
color: "white" |
color: "white" |
||||||
border.color: "black" |
border.color: "black" |
||||||
radius: height / 2 |
radius: height / 2 |
||||||
opacity: control.enabled ? 1 : 0.5 |
opacity: control.enabled ? 1 : 0.5 |
||||||
|
x: control.leftPadding |
||||||
|
y: parent.height / 2 - height / 2 |
||||||
Rectangle { |
Rectangle { |
||||||
anchors.centerIn: parent |
anchors.centerIn: parent |
||||||
width: Math.round(parent.width * 0.5) |
width: Math.round(parent.width * 0.5) |
||||||
height: width |
height: width |
||||||
antialiasing: true |
antialiasing: true |
||||||
radius: height / 2 |
radius: height * 0.5 |
||||||
color: "black" |
color: "black" |
||||||
visible: control.checked |
visible: control.checked |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
|
contentItem: Text { |
||||||
|
text: control.text |
||||||
|
font.pointSize: textFontPointSize |
||||||
|
font.bold: control.textBold |
||||||
|
color: control.textColor |
||||||
|
opacity: enabled ? 1.0 : 0.3 |
||||||
|
verticalAlignment: Text.AlignVCenter |
||||||
|
leftPadding: control.indicator.width + (_noText ? 0 : ScreenTools.defaultFontPixelWidth * 0.25) |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
Loading…
Reference in new issue