- Qt 6.12
- Qt Canvas Painter
- C++ Classes
- 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

- List of all members, including inherited members

## Public Functions

| QCanvasConicalGradient()
| QCanvasConicalGradient(QPointF center, qreal startAngle)
| QCanvasConicalGradient(qreal centerX, qreal centerY, qreal startAngle)
| QCanvasConicalGradient(const QCanvasConicalGradient &)
| QCanvasConicalGradient(QCanvasConicalGradient &&)
| ~QCanvasConicalGradient()
QPointF | centerPosition() const
void | setCenterPosition(qreal x, qreal y)
void | setCenterPosition(QPointF center)
void | setStartAngle(qreal angle)
qreal | startAngle() const
QCanvasConicalGradient & | operator=(QCanvasConicalGradient &&)
QCanvasConicalGradient & | operator=(const QCanvasConicalGradient &)

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

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

Constructs a conical gradient. Gradient center position is center. Gradient start angle is startAngle.

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

Constructs a conical gradient. Gradient center position is ( centerX, centerY). Gradient start angle is startAngle.

### `[constexpr noexcept default]` QCanvasConicalGradient::QCanvasConicalGradient(const QCanvasConicalGradient &)

Copy-constructs an instance of QCanvasConicalGradient.

### `[constexpr noexcept default]` QCanvasConicalGradient::QCanvasConicalGradient(QCanvasConicalGradient &&)

Move-constructs an instance of QCanvasConicalGradient.

### `[constexpr noexcept default]` QCanvasConicalGradient::~QCanvasConicalGradient()

Destroys the instance of QCanvasConicalGradient.

### QPointF QCanvasConicalGradient::centerPosition() const

Returns the center point of conical gradient.

See also setCenterPosition().

### void QCanvasConicalGradient::setCenterPosition(qreal x, qreal 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.

### void QCanvasConicalGradient::setStartAngle(qreal 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 startAngle().

### qreal QCanvasConicalGradient::startAngle() const

Returns the start angle of conical gradient in radians.

See also setStartAngle().

### `[noexcept default]` QCanvasConicalGradient &QCanvasConicalGradient::operator=(QCanvasConicalGradient &&)

Move-assigns other to this QCanvasConicalGradient instance.

### `[noexcept default]` QCanvasConicalGradient &QCanvasConicalGradient::operator=(const QCanvasConicalGradient &)

Copy-assigns other to this QCanvasConicalGradient instance.