本页内容

boxshadow2d QML Value Type

为 `QCanvasBoxShadow` 提供 `boxshadow2d` 类型的匹配。更多内容...

Import Statement: import QtCanvas2D
Since: Qt 6.12
Status: Technology preview

此类型处于技术预览阶段,可能会有变动。

方法

详细说明

此值类型由QtCanvas2D 导入提供。

另请参阅 QCanvasBoxShadow 。

方法文档

real blur()

返回阴影框的模糊效果。

另请参阅 setBlur()。

real bottomLeftRadius()

返回阴影框的左下角半径。当该值为-1 时,绘制阴影时将使用radius()函数为该角计算的值。默认值为-1 。

另请参阅 setBottomLeftRadius()。

real bottomRightRadius()

返回阴影框的右下角半径。当该值为-1 时,绘制阴影时将使用radius()函数为该角计算的值。默认值为-1 。

另请参阅 setBottomRightRadius()。

rect boundingRect()

返回阴影覆盖的区域。此方法会考虑阴影的rect()、blur()和spread()。若不希望使用QCanvasPainter::drawBoxShadow()辅助方法,可利用此方法将尺寸正确的QCanvasPainter::rect()添加到路径中。

另请参阅 setRect()、setBlur(),以及setSpread()。

color color()

返回阴影框的颜色。

另请参阅 setColor()。

real radius()

返回阴影框的半径。

另请参阅 setRadius()。

rect rect()

返回阴影框的矩形面积。

另请参阅 setRect()。

void setBlur(real blur)

将阴影模糊值设置为blur 像素。默认值为0.0 ,表示不进行模糊处理。

另请参阅 blur()。

void setBottomLeftRadius(real radius)

将左下角的圆角半径设置为radius 。默认值为-1 ,这意味着该角未单独设置圆角半径,而是使用通用值radius()。

另请参阅 bottomLeftRadius()。

void setBottomRightRadius(real radius)

将右下角的圆角半径设置为radius 。默认值为-1 ,这意味着该角未单独设置圆角半径,而是使用通用值radius()。

另请参阅 bottomRightRadius()。

void setColor(color shadowColor)

将阴影颜色设置为shadowColor 。默认值为纯黑色且不透明度为100%。

另请参阅 color()。

void setRadius(real radius)

将阴影圆角半径设置为radius 像素。默认值为0.0 ,表示无圆角。

另请参阅 radius()。

void setRect(real x, real y, real width, real height)

将阴影框的矩形区域设置为 (x,y,width,height)。

另请参阅 rect()。

void setRect(rect shadowRect)

将阴影框的矩形区域设置为shadowRect 。

这是一个重载函数。

void setSpread(real spread)

将阴影扩散设置为spread 像素。默认值为0.0 ,表示不扩散。

另请参阅 spread()。

void setTopLeftRadius(real radius)

将左上角的圆角半径设置为radius 。默认值为-1 ,这意味着该角未单独设置圆角半径,而是使用通用圆角radius()。

另请参阅 topLeftRadius()。

void setTopRightRadius(real radius)

将右上角的圆角半径设置为radius 。默认值为-1 ,这意味着该角未单独设置圆角半径,而是使用通用值radius()。

另请参阅 topRightRadius()。

real spread()

返回阴影框的展布。

另请参阅 setSpread()。

real topLeftRadius()

返回阴影框左上角的半径。当该值为-1 时,绘制阴影时将使用该角点的radius()函数返回的值。默认值为-1 。

另请参阅 setTopLeftRadius()。

real topRightRadius()

返回阴影框的右上角半径。当该值为-1 时,绘制阴影时将使用radius()函数为该角计算的值。默认值为-1 。

另请参阅 setTopRightRadius()。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.