PySide6.QtCanvasPainter.QCanvasConicalGradient

class QCanvasConicalGradient

QCanvasConicalGradient is 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.

../../_images/qcconicalgradient-gallery.webp

Here is a simple example:

qcconicalgradient-example1

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();

Inheritance diagram of PySide6.QtCanvasPainter.QCanvasConicalGradient

Synopsis

Methods

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:
  • centerQPointF

  • startAngle – float

Constructs a conical gradient. Gradient center position is center. Gradient start angle is startAngle. 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 is startAngle. 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

setAngle()

centerPosition()
Return type:

QPointF

Returns the center point of conical gradient.

setAngle(angle)
Parameters:

angle – float

Sets the start angle of conical gradient to angle in radians. The angle starts from a line going horizontally right from the center, and proceeds clockwise.

See also

angle()

setCenterPosition(center)
Parameters:

centerQPointF

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

centerPosition()