add fast blur for image

This commit is contained in:
王劲鹏 2021-04-27 10:22:05 +08:00 committed by osborn
parent 6e780c35ad
commit 358f0f0589
2 changed files with 21 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.5
import "util.mjs" as Util
import QtGraphicalEffects 1.12
AnimatedImage {
property var wrapper
@ -83,4 +84,20 @@ AnimatedImage {
mouseAreaBridge.onClick(wrapper)
}
}
property var isBlur: false
onIsBlurChanged: {
console.log(tag, uuid + " onIsBlurChanged: " + this.isBlur)
if (isBlur) {
this.layer.enabled = true
} else {
this.layer.enabled = false
}
}
layer.enabled: false
layer.effect: FastBlur {
radius: 50
transparentBorder: true
}
}

View File

@ -43,6 +43,10 @@ void DoricImageNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
} else if (name == "imageBase64") {
container->setProperty("fillMode", this->contentMode);
container->setProperty("source", prop.toString());
} else if (name == "isBlur") {
if (prop.toBool()) {
container->setProperty("isBlur", prop.toBool());
}
} else {
DoricViewNode::blend(view, name, prop);
}