PySide6.QtCanvasPainter.QCanvasRadialGradient¶
- class QCanvasRadialGradient¶
QCanvasRadialGradientis a brush for radial gradient painting.Details
Radial gradient interpolate colors between start and end points, creating a circle shaped gradient. The gradient is controlled with
centerPosition(),outerRadius()andinnerRadius().
Here is a simple example:

QRectF rect1(0, 0, 200, 200); QCanvasRadialGradient rg(rect1.center(), 100, 0); rg.setColorAt(0.0, "#fdbb2d"); rg.setColorAt(0.6, "#b21f1f"); rg.setColorAt(1.0, "#1a2a6c"); p->setFillStyle(rg); p->fillRect(rect1);
Synopsis¶
Methods¶
def
__init__()def
centerPosition()def
innerRadius()def
outerRadius()def
setInnerRadius()def
setOuterRadius()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
- __init__()¶
Constructs a default radial gradient. Gradient center position is (0, 0). Gradient outer radius is 100.0 and inner radius is 0.0. Gradient start color is white (255, 255, 255) and end color transparent black (0, 0, 0, 0).
- __init__(center, outerRadius[, innerRadius=0.0f])
- Parameters:
center –
QPointFouterRadius – float
innerRadius – float
Constructs a radial gradient. Gradient center position is
center. Gradient outer radius isouterRadiusand inner radius isinnerRadius. Gradient start color is white (255,255,255) and end color transparent black (0, 0, 0, 0).- __init__(centerX, centerY, outerRadius[, innerRadius=0.0f])
- Parameters:
centerX – float
centerY – float
outerRadius – float
innerRadius – float
Constructs a radial gradient. Gradient center position is (
centerX,centerY). Gradient outer radius isouterRadiusand inner radius isinnerRadius. Gradient start color is white (255, 255, 255) and end color transparent black (0, 0, 0, 0).Returns the center point of radial gradient.
See also
- innerRadius()¶
- Return type:
float
Returns the inner radius of radial gradient.
See also
- outerRadius()¶
- Return type:
float
Returns the outer radius of radial gradient.
See also
Sets the center point of radial gradient to
center.- setCenterPosition(x, y)
- Parameters:
x – float
y – float
Sets the center point of radial gradient to (
x,y).See also
- setInnerRadius(radius)¶
- Parameters:
radius – float
Sets the inner radius of radial gradient to
radius. Start color will be drawn at this radius from center position. The default inner radius is0.0meaning that gradient starts directly from center position.See also
- setOuterRadius(radius)¶
- Parameters:
radius – float
Sets the outer radius of radial gradient to
radius. End color will be drawn at this radius from center position.See also