QConicalGradient Class
QConicalGradient 类与QBrush 结合使用,用于指定锥形渐变笔刷。更多
Header: | #include <QConicalGradient> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
继承: | QGradient |
- 所有成员的列表,包括继承成员
- QConicalGradient 属于绘画类。
公共函数
QConicalGradient() | |
QConicalGradient(const QPointF ¢er, qreal angle) | |
QConicalGradient(qreal cx, qreal cy, qreal angle) | |
qreal | angle() const |
QPointF | center() const |
void | setAngle(qreal angle) |
void | setCenter(const QPointF ¢er) |
void | setCenter(qreal x, qreal y) |
详细说明
锥形渐变围绕中心点逆时针插值。
渐变中的颜色是通过QGradientStop 类型的停止点定义的,即一个位置和一种颜色。使用QGradient::setColorAt() 或QGradient::setStops() 函数定义停止点。梯度的整套停止点描述了梯度区域的填充方式。如果没有指定停止点,则会使用从 0 到 1 的黑白渐变。
除了继承自QGradient 的函数外,QConicalGradient 类还提供了angle() 和center() 函数,用于返回梯度的起始角度和中心。
请注意,setSpread() 函数对锥形梯度没有作用。原因是锥形梯度的定义是封闭的,即锥形梯度充满 0 - 360 度的整个圆,而径向梯度或线性梯度的边界可以分别通过其半径或最终停止点来指定。
另请参阅 QLinearGradient,QRadialGradient, 和梯度示例。
成员函数文档
QConicalGradient::QConicalGradient()
以(0,0)为中心构造一个圆锥形,从角度 0 开始插值。
另请参阅 QGradient::setColorAt(),setCenter() 和setAngle()。
QConicalGradient::QConicalGradient(const QPointF ¢er, qreal angle)
使用给定的center 构建锥形梯度,从给定的angle 开始插值。angle 必须以 0 至 360 度之间的度数指定。
另请参阅 QGradient::setColorAt() 和QGradient::setStops() 。
QConicalGradient::QConicalGradient(qreal cx, qreal cy, qreal angle)
以给定的中心 (cx,cy) 构建锥形梯度,从给定的angle 开始插值。角度必须以 0 至 360 度之间的度数指定。
另请参阅 QGradient::setColorAt() 和QGradient::setStops() 。
qreal QConicalGradient::angle() const
以逻辑坐标形式返回锥形梯度的起始角。
QPointF QConicalGradient::center() const
以逻辑坐标形式返回锥形梯度的中心点。
void QConicalGradient::setAngle(qreal angle)
用逻辑坐标设置angle 为锥形渐变的起始角度。
另请参见 angle().
void QConicalGradient::setCenter(const QPointF ¢er)
将逻辑坐标中的锥形梯度中心设置为center 。
另请参阅 center() 。
void QConicalGradient::setCenter(qreal x, qreal y)
这是一个重载函数。
将此锥形梯度的逻辑坐标中心设置为 (x,y)。
另请参见 center().
© 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.