QCBrush Class

QCBrush is the base class for all QCPainter fill / stroke brushes. More...

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

QCBoxShadow, QCCustomBrush, QCGradient, QCGridPattern, and QCImagePattern

Status: Technical Preview

Public Types

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

Public Functions

QCBrush()
QCBrush(QCImage &&other)
QCBrush(const QCBrush &brush)
void swap(QCBrush &other)
QCBrush::BrushType type() const
QCBrush &operator=(QCBrush &&other)
QCBrush &operator=(const QCBrush &brush)

Detailed Description

QCBrush is the base class for all styles used for QCPainter::fill() and QCPainter::stroke().

Member Type Documentation

enum class QCBrush::BrushType

Specifies the type of brush.

ConstantValueDescription
QCBrush::BrushType::Invalid0- Empty brush.
QCBrush::BrushType::LinearGradient1- Interpolates colors between start and end points (QCLinearGradient)
QCBrush::BrushType::RadialGradient2- Interpolates colors between a focal point and end points on a circle surrounding it (QCRadialGradient).
QCBrush::BrushType::ConicalGradient3- Interpolates colors around a center point (QCConicalGradient).
QCBrush::BrushType::BoxGradient4- Interpolates colors on a round rectangle (QCBoxGradient).
QCBrush::BrushType::BoxShadow5- Creates a soft round rectangle shadow (QCBoxShadow).
QCBrush::BrushType::ImagePattern6- Creates a pattern using the specified image and repetition (QCImagePattern).
QCBrush::BrushType::GridPattern7- Creates a pattern using the specified grid (QCGridPattern).
QCBrush::BrushType::Custom1000- Creates a custom shader brush (QCCustomBrush).

See also type().

Member Function Documentation

QCBrush::QCBrush()

Constructs an invalid brush.

[noexcept default] QCBrush::QCBrush(QCImage &&other)

Move-constructs a new QCBrush from other.

[noexcept] QCBrush::QCBrush(const QCBrush &brush)

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

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

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

QCBrush::BrushType QCBrush::type() const

Returns the type of the brush.

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

Move-assigns other to this QCBrush instance.

[noexcept] QCBrush &QCBrush::operator=(const QCBrush &brush)

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