|
|
|
@ -6,96 +6,50 @@ import QGroundControl.Palette 1.0
@@ -6,96 +6,50 @@ import QGroundControl.Palette 1.0
|
|
|
|
|
import QGroundControl.ScreenTools 1.0 |
|
|
|
|
|
|
|
|
|
CheckBox { |
|
|
|
|
activeFocusOnPress: true |
|
|
|
|
property color textColor: _qgcPal.text |
|
|
|
|
property bool textBold: false |
|
|
|
|
property real textFontPointSize: ScreenTools.defaultFontPointSize |
|
|
|
|
|
|
|
|
|
property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } |
|
|
|
|
property bool _noText: text === "" |
|
|
|
|
property real _radius: ScreenTools.defaultFontPixelHeight * 0.16 |
|
|
|
|
|
|
|
|
|
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled } |
|
|
|
|
activeFocusOnPress: true |
|
|
|
|
|
|
|
|
|
style: CheckBoxStyle { |
|
|
|
|
label: Item { |
|
|
|
|
implicitWidth: text.implicitWidth + 2 |
|
|
|
|
implicitHeight: ScreenTools.implicitCheckBoxHeight |
|
|
|
|
implicitWidth: _noText ? 0 : text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25 |
|
|
|
|
implicitHeight: _noText ? 0 : Math.max(text.implicitHeight, ScreenTools.checkBoxIndicatorSize) |
|
|
|
|
baselineOffset: text.baselineOffset |
|
|
|
|
|
|
|
|
|
Rectangle { |
|
|
|
|
anchors.margins: -1 |
|
|
|
|
anchors.leftMargin: -3 |
|
|
|
|
anchors.rightMargin: -3 |
|
|
|
|
anchors.fill: text |
|
|
|
|
visible: control.activeFocus |
|
|
|
|
height: 6 |
|
|
|
|
radius: 3 |
|
|
|
|
color: "#224f9fef" |
|
|
|
|
border.color: "#47b" |
|
|
|
|
opacity: 0.6 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Text { |
|
|
|
|
id: text |
|
|
|
|
text: control.text |
|
|
|
|
antialiasing: true |
|
|
|
|
font.pointSize: ScreenTools.defaultFontPointSize |
|
|
|
|
font.family: ScreenTools.normalFontFamily |
|
|
|
|
color: control.__qgcPal.text |
|
|
|
|
anchors.verticalCenter: parent.verticalCenter |
|
|
|
|
id: text |
|
|
|
|
text: control.text |
|
|
|
|
font.pointSize: textFontPointSize |
|
|
|
|
font.bold: control.textBold |
|
|
|
|
color: control.textColor |
|
|
|
|
anchors.centerIn: parent |
|
|
|
|
} |
|
|
|
|
} // label |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
indicator: Item { |
|
|
|
|
implicitWidth: ScreenTools.checkBoxIndicatorSize |
|
|
|
|
implicitHeight: implicitWidth |
|
|
|
|
|
|
|
|
|
Rectangle { |
|
|
|
|
anchors.fill: parent |
|
|
|
|
anchors.bottomMargin: -1 |
|
|
|
|
color: "#44ffffff" |
|
|
|
|
radius: baserect.radius |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Rectangle { |
|
|
|
|
id: baserect |
|
|
|
|
property var enabledGradient: Gradient { |
|
|
|
|
GradientStop {color: "#eee" ; position: 0} |
|
|
|
|
GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.1} |
|
|
|
|
GradientStop {color: "#fff" ; position: 1} |
|
|
|
|
} |
|
|
|
|
property var disabledGradient: Gradient { |
|
|
|
|
GradientStop {color: "#999" ; position: 0} |
|
|
|
|
GradientStop {color: __qgcPal.textField ; position: 0.1} |
|
|
|
|
GradientStop {color: __qgcPal.textField ; position: 0.9} |
|
|
|
|
GradientStop {color: "#999" ; position: 1} |
|
|
|
|
} |
|
|
|
|
gradient: control.enabled ? enabledGradient : disabledGradient |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
radius: ScreenTools.defaultFontPixelHeight * 0.16 |
|
|
|
|
anchors.fill: parent |
|
|
|
|
border.color: control.activeFocus ? "#47b" : "#999" |
|
|
|
|
opacity: control.enabled ? 1 : 0.5 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Image { |
|
|
|
|
source: "/qmlimages/check.png" |
|
|
|
|
opacity: control.checkedState === Qt.Checked ? control.enabled ? 1 : 0.5 : 0 |
|
|
|
|
anchors.centerIn: parent |
|
|
|
|
anchors.verticalCenterOffset: 1 |
|
|
|
|
Behavior on opacity {NumberAnimation {duration: 80}} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Rectangle { |
|
|
|
|
anchors.fill: parent |
|
|
|
|
anchors.margins: Math.round(baserect.radius) |
|
|
|
|
antialiasing: true |
|
|
|
|
gradient: Gradient { |
|
|
|
|
GradientStop {color: control.pressed ? "#555" : "#999" ; position: 0} |
|
|
|
|
GradientStop {color: "#555" ; position: 1} |
|
|
|
|
anchors.fill: parent |
|
|
|
|
radius: _radius |
|
|
|
|
border.color: "black" |
|
|
|
|
opacity: control.checkedState === Qt.PartiallyChecked ? 0.5 : 1 |
|
|
|
|
|
|
|
|
|
Rectangle { |
|
|
|
|
anchors.margins: parent.height / 4 |
|
|
|
|
anchors.fill: parent |
|
|
|
|
radius: _radius |
|
|
|
|
color: "black" |
|
|
|
|
visible: control.checkedState === Qt.Checked |
|
|
|
|
} |
|
|
|
|
radius: baserect.radius - 1 |
|
|
|
|
anchors.centerIn: parent |
|
|
|
|
anchors.alignWhenCentered: true |
|
|
|
|
border.color: "#222" |
|
|
|
|
Behavior on opacity {NumberAnimation {duration: 80}} |
|
|
|
|
opacity: control.checkedState === Qt.PartiallyChecked ? control.enabled ? 1 : 0.5 : 0 |
|
|
|
|
} |
|
|
|
|
} // indicator |
|
|
|
|
} // style |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|