- 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, float startAngle)
| QCanvasConicalGradient(float centerX, float centerY, float startAngle)
| QCanvasConicalGradient(const QCanvasConicalGradient &)
| QCanvasConicalGradient(QCanvasConicalGradient &&)
float | angle() const
QPointF | centerPosition() const
void | setAngle(float angle)
void | setCenterPosition(float x, float y)
void | setCenterPosition(QPointF center)
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. 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).

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

Copy-constructs an instance of QCanvasConicalGradient.

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

Move-constructs an instance of QCanvasConicalGradient.

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

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