Browse Source

Update CustomOnOffSwitch.qml

Custon On / Off  switch updated to show label when off. Now works more like a toggle
QGC4.4
Yasen 6 years ago
parent
commit
052c5c9142
  1. 15
      custom-example/res/Custom/Widgets/CustomOnOffSwitch.qml

15
custom-example/res/Custom/Widgets/CustomOnOffSwitch.qml

@ -20,8 +20,8 @@ Rectangle { @@ -20,8 +20,8 @@ Rectangle {
height: Math.round(ScreenTools.defaultFontPixelHeight * 2)
width: ScreenTools.defaultFontPixelWidth * 10
color: qgcPal.button
border.color: qgcPal.text
border.width: 1
border.color: qgcPal.windowShade
border.width: 0
property bool checked: true
@ -32,24 +32,23 @@ Rectangle { @@ -32,24 +32,23 @@ Rectangle {
Rectangle {
width: parent.width * 0.5
height: parent.height
color: qgcPal.windowShade
visible: !checked
color: checked ? qgcPal.button : qgcPal.buttonHighlight
border.color: qgcPal.text
border.width: 1
border.width: 0
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
QGCLabel {
text: qsTr("Off")
anchors.centerIn: parent
color: qgcPal.text
}
}
Rectangle {
width: parent.width * 0.5
height: parent.height * 0.95
color: qgcPal.buttonHighlight
visible: checked
color: checked ? qgcPal.buttonHighlight : qgcPal.button
border.color: qgcPal.text
border.width: 1
border.width: 0
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
QGCLabel {

Loading…
Cancel
Save