QSGFlatColorMaterial Class

The QSGFlatColorMaterial class provides a convenient way of rendering solid colored geometry in the scene graph. More...

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

Public Functions

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

Detailed Description

Warning: This utility class is only functional when running with the default backend of the Qt Quick scenegraph.

The flat color material will fill every pixel in a geometry using a solid color. The color can contain transparency.

The geometry to be rendered with a flat color material requires vertices in attribute location 0 in the QSGGeometry object to render correctly. The QSGGeometry::defaultAttributes_Point2D() returns an attribute set compatible with this material.

The flat color material respects both current opacity and current matrix when updating its rendering state.

Member Function Documentation

QSGFlatColorMaterial::QSGFlatColorMaterial()

Constructs a new flat color material.

The default color is white.

const QColor &QSGFlatColorMaterial::color() const

Returns this flat color material's color.

The default color is white.

See also setColor().

void QSGFlatColorMaterial::setColor(const QColor &color)

Sets this flat color material's color to color.

See also color().

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