QCanvasConicalGradient Class | Qt Canvas Painter | Qt 6.11.1
Description: QCanvasConicalGradient is a brush for conical gradient painting.

- Qt 6.11
- Qt Canvas Painter
- C++ Classes
- QtCanvasPainter (Technical Preview)
- QCanvasConicalGradient
- Qt Canvas Painter | Commercial or GPLv3

# QCanvasConicalGradient Class

QCanvasConicalGradient is a brush for conical gradient painting. More...

Header: | `#include <QCanvasConicalGradient>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS CanvasPainter)` `target_link_libraries(mytarget PRIVATE Qt6::CanvasPainter)`
Since: | Qt 6.11
Inherits: | QCanvasGradient
Status: | Technical Preview

- List of all members, including inherited members

## Public Functions

| QCanvasConicalGradient()
| QCanvasConicalGradient(QPointF center, float startAngle)
| QCanvasConicalGradient(float centerX, float centerY, float startAngle)
float | angle() const
QPointF | centerPosition() const
void | setAngle(float angle)
void | setCenterPosition(float x, float y)
void | setCenterPosition(QPointF center)

## Detailed Description

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

## Member Function Documentation

### QCanvasConicalGradient::QCanvasConicalGradient()

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).

### QCanvasConicalGradient::QCanvasConicalGradient(QPointF center, float startAngle)

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).

### QCanvasConicalGradient::QCanvasConicalGradient(float centerX, float centerY, float startAngle)

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).

### float QCanvasConicalGradient::angle() const

Returns the start angle of conical gradient in radians.

See also setAngle().

### QPointF QCanvasConicalGradient::centerPosition() const

Returns the center point of conical gradient.

See also setCenterPosition().

### void QCanvasConicalGradient::setAngle(float angle)

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

### void QCanvasConicalGradient::setCenterPosition(float x, float y)

Sets the center point of conical gradient to ( x, y).

See also centerPosition().

### void QCanvasConicalGradient::setCenterPosition(QPointF center)

Sets the center point of conical gradient to center.

This is an overloaded function.