Window {
color: "#00000000"
MainView {
anchors.fill: parent
}
}
其中 Window 背景色要设置成透明色,不然阴影不能透明
MainView是我实现一个背景类。 magin =5
里面背景如下
MainView.qml
import QtGraphicalEffects 1.0
Item {
id:root
width: 360
height: 1050
//背景
DropShadow {
anchors.fill: back_rect
horizontalOffset: 0
verticalOffset: 0
samples: 17
color: "#20000000"
source: back_rect
}
Rectangle{
id:back_rect
visible: false
anchors.fill: root
anchors.margins: 5
color: "#ffffff"
z:0
}
}