前言
通过QML的QtGraphicalEffects模块实现的透明,可以使用FastBlur或GaussianBlur。
一、效果
二、代码
1.模块代码
//Rect_blur.qml
import QtQuick 2.0
import QtGraphicalEffects 1.14
Rectangle {
property Item m_source
property bool m_dragable: true //未使用
property color border_color: "transparent"
property int border_radius: 10
property int blur_radius: 32
id:blur_rect
width: 100
height: 100
radius: border_radius
clip: true
MouseArea {
anchors.fill: parent
drag.target: parent
drag.axis: Drag.XAndYAxis
}
Rectangle{
id:blur_1
anchors.fill: parent
clip: true
visible:false
FastBlur{
id:blur
width: m_source.width
height