import QtQuick 2.0
import QtGraphicalEffects 1.12
Rectangle {
width: 300
height: 50
property var shadowColor:"black"
//这里边框颜色的alpha值一定要非0,否则没效果
border.color: Qt.rgba(0, 0, 0, 0.01)
border.width: 4
radius: 12
layer.enabled: true
layer.effect: InnerShadow {
color: "#33000000"
samples: 12
radius: 6
spread: 0.4
}
}
原文: QML 阴影边框实现_Marrrrrco的博客-CSDN博客_qml阴影效果
防丢备份!