En esta página

QSGSimpleTextureNode Class

La clase QSGSimpleTextureNode se proporciona por conveniencia para dibujar fácilmente contenido texturizado utilizando el gráfico de escena QML. Más...

Cabecera: #include <QSGSimpleTextureNode>
CMake: find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
Hereda: QSGGeometryNode

Tipos Públicos

enum TextureCoordinatesTransformFlag { NoTransform, MirrorHorizontally, MirrorVertically }
flags TextureCoordinatesTransformMode

Funciones Públicas

QSGSimpleTextureNode()
virtual ~QSGSimpleTextureNode() override
QSGTexture::Filtering filtering() const
bool ownsTexture() const
QRectF rect() const
void setFiltering(QSGTexture::Filtering filtering)
void setOwnsTexture(bool owns)
void setRect(const QRectF &r)
void setRect(qreal x, qreal y, qreal w, qreal h)
void setSourceRect(const QRectF &r)
void setSourceRect(qreal x, qreal y, qreal w, qreal h)
void setTexture(QSGTexture *texture)
void setTextureCoordinatesTransform(QSGSimpleTextureNode::TextureCoordinatesTransformMode mode)
QRectF sourceRect() const
QSGTexture *texture() const
QSGSimpleTextureNode::TextureCoordinatesTransformMode textureCoordinatesTransform() const

Descripción Detallada

Advertencia: La clase nodo de textura simple debe tener una textura antes de ser añadida al grafo de escena para ser renderizada.

Advertencia: Esta clase de utilidad sólo es funcional cuando se ejecuta con los backends por defecto o por software del scenegraph Qt Quick. Como alternativa, es preferible utilizar QSGImageNode a través de QQuickWindow::createImageNode(). Sin embargo, esta clase independiente sigue siendo útil cuando se utiliza a través de subclases y la aplicación sabe que no hay backends especiales de scenegraph involucrados.

Documentación de tipos de miembros

enum QSGSimpleTextureNode::TextureCoordinatesTransformFlag
flags QSGSimpleTextureNode::TextureCoordinatesTransformMode

El enum TextureCoordinatesTransformFlag se utiliza para especificar el modo utilizado para generar las coordenadas de textura de un quad texturizado.

ConstanteValorDescripción
QSGSimpleTextureNode::NoTransform0x00Las coordenadas de textura se orientan con las coordenadas de ventana, es decir, con el origen en la parte superior izquierda.
QSGSimpleTextureNode::MirrorHorizontally0x01Las coordenadas de la textura se invierten en el eje horizontal con respecto a las coordenadas de la ventana
QSGSimpleTextureNode::MirrorVertically0x02Las coordenadas de la textura se invierten en el eje vertical con respecto a las coordenadas de la ventana.

El tipo TextureCoordinatesTransformMode es un typedef para QFlags<TextureCoordinatesTransformFlag>. Almacena una combinación OR de valores TextureCoordinatesTransformFlag.

Documentación de la Función Miembro

QSGSimpleTextureNode::QSGSimpleTextureNode()

Construye un nuevo nodo de textura simple

[override virtual noexcept] QSGSimpleTextureNode::~QSGSimpleTextureNode()

Destruye el nodo de textura

QSGTexture::Filtering QSGSimpleTextureNode::filtering() const

Devuelve el filtrado actualmente establecido en este nodo de textura

Ver también setFiltering().

bool QSGSimpleTextureNode::ownsTexture() const

Devuelve true si el nodo se apropia de la textura; en caso contrario devuelve false.

Véase también setOwnsTexture().

QRectF QSGSimpleTextureNode::rect() const

Devuelve el rectángulo objetivo de este nodo de textura.

Véase también setRect().

void QSGSimpleTextureNode::setFiltering(QSGTexture::Filtering filtering)

Establece el filtrado a usar para este nodo de textura en filtering.

Para un escalado suave, usa QSGTexture::Linear; para un escalado normal, usa QSGTexture::Nearest.

Ver también filtering().

void QSGSimpleTextureNode::setOwnsTexture(bool owns)

Establece si el nodo toma posesión de la textura en owns.

Por defecto, el nodo no se apropia de la textura.

Véase también ownsTexture() y setTexture().

void QSGSimpleTextureNode::setRect(const QRectF &r)

Establece el rectángulo objetivo de este nodo de textura a r.

Ver también rect().

void QSGSimpleTextureNode::setRect(qreal x, qreal y, qreal w, qreal h)

Establece el rectángulo de este nodo de textura para que comience en (x, y) y tenga un ancho w y un alto h.

Esta es una función sobrecargada.

void QSGSimpleTextureNode::setSourceRect(const QRectF &r)

Establece el rectángulo fuente de este nodo de textura a r.

Ver también sourceRect().

void QSGSimpleTextureNode::setSourceRect(qreal x, qreal y, qreal w, qreal h)

Establece el rectángulo de este nodo de textura para mostrar su textura desde (x, y) y tener ancho w y alto h relativamente al QSGTexture::textureSize.

Esta es una función sobrecargada.

void QSGSimpleTextureNode::setTexture(QSGTexture *texture)

Establece la textura de este nodo de textura a texture.

Usa setOwnsTexture() para establecer si el nodo debe tomar posesión de la textura. Por defecto, el nodo no toma la propiedad.

Advertencia: Un nodo de textura debe tener una textura antes de ser añadido al scenegraph para ser renderizado.

Ver también texture().

void QSGSimpleTextureNode::setTextureCoordinatesTransform(QSGSimpleTextureNode::TextureCoordinatesTransformMode mode)

Establece el método utilizado para generar las coordenadas de la textura en mode. Esto se puede utilizar para obtener la orientación correcta de la textura. Esto es comúnmente necesario cuando se utiliza una librería OpenGL de terceros para renderizar la textura ya que OpenGL tiene un eje y invertido en relación a Qt Quick.

Véase también textureCoordinatesTransform().

QRectF QSGSimpleTextureNode::sourceRect() const

Devuelve el rectángulo fuente de este nodo de textura.

Véase también setSourceRect().

QSGTexture *QSGSimpleTextureNode::texture() const

Devuelve la textura de este nodo de textura

Ver también setTexture().

QSGSimpleTextureNode::TextureCoordinatesTransformMode QSGSimpleTextureNode::textureCoordinatesTransform() const

Devuelve el modo utilizado para generar las coordenadas de textura para este nodo.

Véase también setTextureCoordinatesTransform().

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