RadialGradient QML Type

径向梯度。更多

Import Statement: import QtQuick.Shapes 1.9
Inherits:

ShapeGradient

属性

详细说明

径向渐变在 "形状 "项目中的焦点圆和中心圆之间插入颜色。两个圆所定义的锥体外的点将是透明的。

在端点之外,渐变将根据扩散类型进行填充、反射或重复。

下面是一个简单的径向渐变示例。这里的颜色是在指定点和半径指定的圆的端点之间内插的:

fillGradient: RadialGradient {
    centerX: 50; centerY: 50
    centerRadius: 100
    focalX: centerX; focalY: centerY
    GradientStop { position: 0; color: "blue" }
    GradientStop { position: 0.2; color: "green" }
    GradientStop { position: 0.4; color: "red" }
    GradientStop { position: 0.6; color: "yellow" }
    GradientStop { position: 1; color: "cyan" }
}

此外,还支持扩展的径向渐变,即指定一个单独的焦点圆。

注: RadialGradient 仅支持与 "形状 "项结合使用。它与Rectangle 不兼容,因为 仅支持Gradient

另请参阅 QRadialGradient

属性文档

centerX : real

centerY : real

focalX : real

focalY : real

这些属性定义了中心点和焦点。要指定简单的径向梯度,可将focalXfocalY 分别设为centerXcenterY 的值。


centerRadius : real

focalRadius : real

这些属性定义了中心和焦点半径。0 对于简单的径向渐变,focalRadius (默认值)。


© 2025 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.