QSGFlatColorMaterial Class

QSGFlatColorMaterial 类提供了一种在场景图中渲染纯色几何体的便捷方法。更多

Header: #include <QSGFlatColorMaterial>
CMake: find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
继承: QSGMaterial

公共函数

QSGFlatColorMaterial()
const QColor &color() const
void setColor(const QColor &color)

详细说明

警告: 该实用程序类只有在运行Qt Quick 场景图的默认后台时才有效。

纯色材质将使用纯色填充几何体中的每个像素。颜色可以包含透明度。

使用纯色材质渲染的几何体要求顶点位于QSGGeometry 对象中的属性位置 0,这样才能正确渲染。QSGGeometry::defaultAttributes_Point2D() 返回与此材质兼容的属性集。

平涂材质在更新其渲染状态时,会同时尊重当前不透明度和当前矩阵。

成员函数文档

QSGFlatColorMaterial::QSGFlatColorMaterial()

创建一个新的平面彩色材质。

默认颜色为白色。

const QColor &QSGFlatColorMaterial::color() const

返回该平面颜色材料的颜色。

默认颜色为白色。

另请参见 setColor()。

void QSGFlatColorMaterial::setColor(const QColor &color)

将此平面颜色材料的颜色设置为color

另请参阅 color() 。

© 2025 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.