1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
/**
@~chinese
@class RectangularShadow
@ingroup Item
@ingroup QML_TYPES
@brief 一种只支持硬件渲染模式的矩形阴影控件.
@details
RectangularShadow 是 GlowEffect 应用形态,它重新整理了 GlowEffect 的各个属性,并将其修饰为
更容易理解的属性名称。 RectangularShadow 相对于 GlowEffect 更容易使用。
但 RectangularShadow 和 GlowEffect 都有同样的缺点:暂不支持使用软件渲染。因此使用这两种效果时
需要注意对不同渲染模式的适配。如果在使用中更倾向于软硬件的兼容,请使用: BoxShadow 效果。
RectangularShadow 和 GlowEffect 一样,都提供一种矩形阴影效果。RectangularShadow的
使用方式如下所示:
```qml
RectangularShadow {
anchors.fill: shadowSource
glowRadius: 20
spread: 0
color: "black"
cornerRadius: shadowSource.radius
}
Rectangle {
id: shadowSource
width: 120
height: 120
radius: 16
color: "red"
}
```
其效果如下图所示:
@image html RectangularShadowExample.png
@property real RectangularShadow::offsetX
@brief offsetX 属性定义阴影在x轴方向上的偏移,默认是0。
@property real RectangularShadow::offsetY
@brief offsetY 属性定义阴影在y轴方向上的偏移,默认是0。
@property real RectangularShadow::glowRadius
@brief glowRadius 属性定义阴影到达项目区域外部(或内部)的像素数,默认是 0。
@property real RectangularShadow::spread
@brief spread 属性定义在源四周区域的阴影颜色的增强程度,默认是0
@property color RectangularShadow::color
@brief color 属性定义阴影颜色。
@property real RectangularShadow::cornerRadius
@brief cornerRadius 属性定义绘制阴影的控件的圆角大小。
@property bool RectangularShadow::fill
@brief fill 属性定义阴影是否填充整个区域。
*/
|