QSGImageNode Class

The QSGImageNode class is provided for convenience to easily draw textured content using the QML scene graph. More...

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

Public Types

enum TextureCoordinatesTransformFlag { NoTransform, MirrorHorizontally, MirrorVertically }
flags TextureCoordinatesTransformMode

Static Public Members

void rebuildGeometry(QSGGeometry *g, QSGTexture *texture, const QRectF &rect, QRectF sourceRect, TextureCoordinatesTransformMode texCoordMode)

Detailed Description

Warning: The image node class must have a texture before being added to the scene graph to be rendered.

Member Type Documentation

enum QSGImageNode::TextureCoordinatesTransformFlag
flags QSGImageNode::TextureCoordinatesTransformMode

The TextureCoordinatesTransformFlag enum is used to specify the mode used to generate texture coordinates for a textured quad.

ConstantValueDescription
QSGImageNode::NoTransform0x00Texture coordinates are oriented with window coordinates i.e. with origin at top-left.
QSGImageNode::MirrorHorizontally0x01Texture coordinates are inverted in the horizontal axis with respect to window coordinates
QSGImageNode::MirrorVertically0x02Texture coordinates are inverted in the vertical axis with respect to window coordinates

The TextureCoordinatesTransformMode type is a typedef for QFlags<TextureCoordinatesTransformFlag>. It stores an OR combination of TextureCoordinatesTransformFlag values.

Member Function Documentation

[static] void QSGImageNode::rebuildGeometry(QSGGeometry *g, QSGTexture *texture, const QRectF &rect, QRectF sourceRect, TextureCoordinatesTransformMode texCoordMode)

Updates the geometry g with the texture, the coordinates in rect, and the texture coordinates from sourceRect.

g is assumed to be a triangle strip of four vertices of type QSGGeometry::TexturedPoint2D.

texCoordMode is used for normalizing the sourceRect.