PySide6.QtCanvasPainter.QCanvasConicalGradient¶
- class QCanvasConicalGradient¶
QCanvasConicalGradientis a brush for conical gradient painting.Details
Conical gradient interpolate colors between start and end points around a point with given coordinates. The angle starts from a line going horizontally right from the center, and proceeds clockwise.
Here is a simple example:

QRectF rect(20, 20, 160, 160); QCanvasConicalGradient cg(rect.center(), 1.75 * M_PI); cg.setColorAt(0.0, "#fdbb2d"); cg.setColorAt(0.5, "#1a2a6c"); cg.setColorAt(1.0, "#fdbb2d"); p->setFillStyle(cg); p->beginPath(); p->ellipse(rect); p->fill();
Synopsis¶
Methods¶
def
__init__()def
angle()def
centerPosition()def
setAngle()
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 conical gradient. Gradient center position is (0, 0). Gradient angle is 0.0. Gradient start color is white (255, 255, 255) and end color transparent black (0, 0, 0, 0).
- __init__(center, startAngle)
- Parameters:
center –
QPointFstartAngle – float
Constructs a conical gradient. Gradient center position is
center. Gradient start angle isstartAngle. Gradient start color is white (255, 255, 255) and end color transparent black (0, 0, 0, 0).- __init__(centerX, centerY, startAngle)
- Parameters:
centerX – float
centerY – float
startAngle – float
Constructs a conical gradient. Gradient center position is (
centerX,centerY). Gradient start angle isstartAngle. Gradient start color is white (255, 255, 255) and end color transparent black (0, 0, 0, 0).- angle()¶
- Return type:
float
Returns the start angle of conical gradient in radians.
See also
Returns the center point of conical gradient.
See also
- setAngle(angle)¶
- Parameters:
angle – float
Sets the start angle of conical gradient to
anglein radians. The angle starts from a line going horizontally right from the center, and proceeds clockwise.See also
Sets the center point of conical gradient to
center.- setCenterPosition(x, y)
- Parameters:
x – float
y – float
Sets the center point of conical gradient to (
x,y).See also