This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/example/doric/resources/switch.qml

34 lines
743 B
QML
Raw Normal View History

2021-05-27 16:56:57 +08:00
import QtQuick 2.12
import QtQuick.Controls 2.5
2021-05-27 18:02:14 +08:00
import "util.mjs" as Util
2021-05-27 16:56:57 +08:00
Switch {
2021-05-27 18:02:14 +08:00
property var wrapper
property var uuid: Util.uuidv4()
property var tag: "Switch"
2021-05-27 18:06:43 +08:00
property var offTintColor: "#e6e6e6"
property var onTintColor: "#52d769"
2021-05-27 18:02:14 +08:00
property var thumbTintColor: "white"
Component.onCompleted: {
this.indicator.children[1].color = thumbTintColor
}
onThumbTintColorChanged: {
this.indicator.children[1].color = thumbTintColor
}
2021-05-27 16:56:57 +08:00
2021-05-27 18:02:14 +08:00
onCheckedChanged: {
if (checked) {
this.indicator.children[0].color = onTintColor
} else {
this.indicator.children[0].color = offTintColor
}
2021-05-27 18:18:30 +08:00
switchBridge.onSwitch(wrapper, checked)
2021-05-27 18:02:14 +08:00
}
2021-05-27 16:56:57 +08:00
}