TG-PlatformPlus/qml/debug/gamma/common/QxSwitch.qml

41 lines
760 B
QML
Raw Normal View History

2026-03-02 14:29:58 +08:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Item {
width: parent.width/parent.childcount
property var col: ""
property var value: "0"
property var text: "0"
onTextChanged: {
if(text == "1")
sw.checked = true
else
sw.checked = false
}
height: 30
clip: true
Rectangle{
width: 1
height: parent.height
color: "#222"
anchors.right: parent.right
}
Rectangle{
width: parent.width
height: 1
color: "#222"
anchors.bottom: parent.bottom
}
Switch {
id: sw
anchors.centerIn: parent
checked: false
onCheckedChanged: parent.value = (checked? "1": "0")
}
}