一. 控件内部添加阴影效果
Rectangle {
radius: 4
border.width: 1
border.color: "#679C9C9C"
layer.enabled: true
layer.effect: DropShadow {
horizontalOffset: 2
verticalOffset: 3
color: "#30000000"
samples: 12
}
}
二.控件外部实现阴影效果
Rectangle {
id: b
anchors.fill: parent
anchors.margins: 5
radius: 5
}
DropShadow {
anchors.fill: b
radius: 5.0
samples: 12
color: Theme.back_shadow_color
source: b
}
三.参数解析
horizontalOffset:水平方向上阴影偏移像素,不设置默认四周。
verticalOffset: 垂直方向上阴影偏移像素,不设置默认四周。
color: "#30000000" 颜色设置,30两个位代表透明度,后面6位代表黑色。
samples: 12 采样数,越大,阴影效果越浓。
radius: 5 阴影圆角。
1961

被折叠的 条评论
为什么被折叠?



