QCanvasBrush Class

QCanvasBrush is the base class for all QCanvasPainter fill / stroke brushes. More...

Header: #include <QCanvasBrush>
CMake: find_package(Qt6 REQUIRED COMPONENTS CanvasPainter)
target_link_libraries(mytarget PRIVATE Qt6::CanvasPainter)
Since: Qt 6.11
Inherited By:

QCanvasBoxShadow, QCanvasCustomBrush, QCanvasGradient, QCanvasGridPattern, and QCanvasImagePattern

Status: Technology preview

This class is in technology preview and is subject to change.

Public Types

enum class BrushType { Invalid, LinearGradient, RadialGradient, ConicalGradient, BoxGradient, …, Custom }

Public Functions

QCanvasBrush()
QCanvasBrush(QCanvasImage &&other)
QCanvasBrush(const QCanvasBrush &brush)
QCanvasBrush(QCanvasBrush &&other)
void swap(QCanvasBrush &other)
QCanvasBrush::BrushType type() const
QCanvasBrush &operator=(QCanvasBrush &&other)
QCanvasBrush &operator=(const QCanvasBrush &brush)

Detailed Description

QCanvasBrush is the base class for all styles used for QCanvasPainter::fill() and QCanvasPainter::stroke().

Member Type Documentation

enum class QCanvasBrush::BrushType

Specifies the type of brush.

ConstantValueDescription
QCanvasBrush::BrushType::Invalid0- Empty brush.
QCanvasBrush::BrushType::LinearGradient1- Interpolates colors between start and end points (QCanvasLinearGradient)
QCanvasBrush::BrushType::RadialGradient2- Interpolates colors between a focal point and end points on a circle surrounding it (QCanvasRadialGradient).
QCanvasBrush::BrushType::ConicalGradient3- Interpolates colors around a center point (QCanvasConicalGradient).
QCanvasBrush::BrushType::BoxGradient4- Interpolates colors on a round rectangle (QCanvasBoxGradient).
QCanvasBrush::BrushType::BoxShadow5- Creates a soft round rectangle shadow (QCanvasBoxShadow).
QCanvasBrush::BrushType::ImagePattern6- Creates a pattern using the specified image and repetition (QCanvasImagePattern).
QCanvasBrush::BrushType::GridPattern7- Creates a pattern using the specified grid (QCanvasGridPattern).
QCanvasBrush::BrushType::Custom1000- Creates a custom shader brush (QCanvasCustomBrush).

See also type().

Member Function Documentation

QCanvasBrush::QCanvasBrush()

Constructs an invalid brush.

[noexcept implicit] QCanvasBrush::QCanvasBrush(QCanvasImage &&other)

Move-constructs a new QCanvasBrush from other.

QCanvasBrush::QCanvasBrush(const QCanvasBrush &brush)

Constructs a brush that is a copy of the given brush.

[constexpr noexcept default] QCanvasBrush::QCanvasBrush(QCanvasBrush &&other)

Move-constructs an instance of QCanvasBrush.

[noexcept] void QCanvasBrush::swap(QCanvasBrush &other)

Swaps this brush with other. This operation is very fast and never fails.

QCanvasBrush::BrushType QCanvasBrush::type() const

Returns the type of the brush.

[noexcept] QCanvasBrush &QCanvasBrush::operator=(QCanvasBrush &&other)

Move-assigns other to this QCanvasBrush instance.

QCanvasBrush &QCanvasBrush::operator=(const QCanvasBrush &brush)

Assigns the given brush to this brush and returns a reference to this brush.