加入DropShadow后会出现失真。为什么会出现扭曲?
QML ListView失真:

或者还有另外一种方法来给元素添加阴影?下面是应用程序的完整代码: main.qml - main委托- 产权观
delegate: PropertiesView {
id: delegateElement
anchors.left: parent.left
anchors.leftMargin: 10
anchors.right: parent.right
anchors.rightMargin: 10
background: Rectangle {
id: elementDevice
implicitWidth: 100
implicitHeight: 40
opacity: enabled ? 1 : 0.3
color: delegateElement.down ? "#dddedf" : "#eeeeee"
}
DropShadow {
anchors.fill: parent
cached: true
horizontalOffset: 3
verticalOffset: 3
radius: 8.0
samples: 16
color: "#80000000"
source: parent
}
}
}发布于 2021-02-18 09:59:30
尝尝这个
delegate: Item{
anchors.left: parent.left
anchors.leftMargin: 10
anchors.right: parent.right
anchors.rightMargin: 10
implicitHeight: delegateElement.implicitHeight
PropertiesView {
id: delegateElement
anchors.fill: parent
smooth: true
opacity: 0
background: Rectangle {
implicitHeight: 40
opacity: enabled ? 1 : 0.3
color: delegateElement.down ? "#dddedf" : "#eeeeee"
}
}
DropShadow {
anchors.fill: delegateElement
source: delegateElement
cached: true
horizontalOffset: 3
verticalOffset: 3
radius: 8.0
samples: 16
color: "#80000000"
}
}https://stackoverflow.com/questions/66256571
复制相似问题