在本页

QCanvasBrush Class

QCanvasBrush 是所有QCanvasPainter 填充/描边笔刷的基类。更多

Header: #include <QCanvasBrush>
CMake: find_package(Qt6 REQUIRED COMPONENTS CanvasPainter)
target_link_libraries(mytarget PRIVATE Qt6::CanvasPainter)
Qt 6.11
继承者:

QCanvasBoxShadow,QCanvasCustomBrush,QCanvasGradient,QCanvasGridPattern, 和QCanvasImagePattern

状态:技术预览

公共类型

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

公共函数

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

详细说明

QCanvasBrush 是用于QCanvasPainter::fill() 和QCanvasPainter::stroke() 的所有样式的基类。

成员类型文档

enum class QCanvasBrush::BrushType

指定笔刷类型。

常数说明
QCanvasBrush::BrushType::Invalid0- 空笔刷。
QCanvasBrush::BrushType::LinearGradient1- 在起点和终点之间插值 (QCanvasLinearGradient)
QCanvasBrush::BrushType::RadialGradient2- 在焦点和其周围圆的端点之间插值 (QCanvasRadialGradient).
QCanvasBrush::BrushType::ConicalGradient3- 围绕中心点插值 (QCanvasConicalGradient)。
QCanvasBrush::BrushType::BoxGradient4- 在圆形矩形上内插颜色 (QCanvasBoxGradient)。
QCanvasBrush::BrushType::BoxShadow5- 创建柔和的圆形矩形阴影 (QCanvasBoxShadow)。
QCanvasBrush::BrushType::ImagePattern6- 使用指定图像和重复创建图案 (QCanvasImagePattern)。
QCanvasBrush::BrushType::GridPattern7- 使用指定的网格创建图案 (QCanvasGridPattern)。
QCanvasBrush::BrushType::Custom1000- 创建自定义着色器笔刷 (QCanvasCustomBrush)。

另请参阅 type().

成员函数文档

QCanvasBrush::QCanvasBrush()

构造一个无效的笔刷。

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

移动-从other 构建一个新的 QCanvasBrush。

QCanvasBrush::QCanvasBrush(const QCanvasBrush &brush)

构建一个笔刷,它是给定brush 的副本。

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

将该刷子与other 互换。这一操作非常快速,而且从未出现过故障。

QCanvasBrush::BrushType QCanvasBrush::type() const

返回笔刷的类型。

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

Move-assignsother 到此QCanvasBrush 实例。

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

将给定的brush 分配给此笔刷,并返回此笔刷的引用。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.