handle tint color for on, off & thumb

This commit is contained in:
王劲鹏
2021-05-27 18:02:14 +08:00
committed by osborn
parent 2328afdb01
commit aa030a4fb9
3 changed files with 45 additions and 5 deletions

View File

@@ -21,15 +21,22 @@ QQuickItem *DoricSwitchNode::build() {
void DoricSwitchNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
if (name == "state") {
checkByCodeToggle = true;
view->setProperty("checked", prop.toBool());
checkByCodeToggle = false;
} else if (name == "onSwitch") {
} else if (name == "offTintColor") {
view->setProperty(
"offTintColor",
QVariant::fromValue(DoricUtils::doricColor(prop.toInt())));
} else if (name == "onTintColor") {
view->setProperty("onTintColor", QVariant::fromValue(
DoricUtils::doricColor(prop.toInt())));
} else if (name == "thumbTintColor") {
view->setProperty(
"thumbTintColor",
QVariant::fromValue(DoricUtils::doricColor(prop.toInt())));
} else {
DoricViewNode::blend(view, name, prop);
}