QSGSimpleTextureNode Class
La classe QSGSimpleTextureNode è stata fornita per facilitare la creazione di contenuti con texture utilizzando il grafico di scena QML. Per saperne di più...
| Intestazione: | #include <QSGSimpleTextureNode> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
| qmake: | QT += quick |
| Eredita: | QSGGeometryNode |
Tipi pubblici
| enum | TextureCoordinatesTransformFlag { NoTransform, MirrorHorizontally, MirrorVertically } |
| flags | TextureCoordinatesTransformMode |
Funzioni pubbliche
| 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 |
Descrizione dettagliata
Avviso: la classe del nodo texture semplice deve disporre di una texture prima di essere aggiunta al grafo di scena per poter essere renderizzata.
Avviso: questa classe di utilità è funzionante solo se eseguita con i backend predefiniti o software del grafo di scena Qt Quick. In alternativa, è preferibile utilizzare QSGImageNode tramite QQuickWindow::createImageNode(). Tuttavia, questa classe autonoma è comunque utile se utilizzata tramite sottoclassificazione e l’applicazione sa che non saranno coinvolti backend speciali del grafo di scena.
Documentazione sui tipi dei membri
enum QSGSimpleTextureNode::TextureCoordinatesTransformFlag
flags QSGSimpleTextureNode::TextureCoordinatesTransformMode
L'enumerazione `TextureCoordinatesTransformFlag` viene utilizzata per specificare la modalità utilizzata per generare le coordinate di texture per un quadrilatero con texture.
| Costante | Valore | Descrizione |
|---|---|---|
QSGSimpleTextureNode::NoTransform | 0x00 | Le coordinate di texture sono orientate in base alle coordinate della finestra, ovvero con origine in alto a sinistra. |
QSGSimpleTextureNode::MirrorHorizontally | 0x01 | Le coordinate di texture sono invertite sull'asse orizzontale rispetto alle coordinate della finestra |
QSGSimpleTextureNode::MirrorVertically | 0x02 | Le coordinate della texture sono invertite sull'asse verticale rispetto alle coordinate della finestra |
Il tipo `TextureCoordinatesTransformMode` è un `typedef` per ` QFlags<TextureCoordinatesTransformFlag>`. Memorizza una combinazione OR di valori `TextureCoordinatesTransformFlag`.
Documentazione delle funzioni membro
QSGSimpleTextureNode::QSGSimpleTextureNode()
Crea un nuovo nodo texture semplice
[override virtual noexcept] QSGSimpleTextureNode::~QSGSimpleTextureNode()
Elimina il nodo “texture”
QSGTexture::Filtering QSGSimpleTextureNode::filtering() const
Restituisce il filtro attualmente impostato su questo nodo texture
Vedi anche setFiltering().
bool QSGSimpleTextureNode::ownsTexture() const
Restituisce ` true ` se il nodo acquisisce la proprietà della texture; altrimenti restituisce ` false`.
Vedi anche setOwnsTexture().
QRectF QSGSimpleTextureNode::rect() const
Restituisce il rettangolo di destinazione di questo nodo texture.
Vedi anche ` setRect()`.
void QSGSimpleTextureNode::setFiltering(QSGTexture::Filtering filtering)
Imposta il filtro da utilizzare per questo nodo texture su “ filtering ”.
Per un ridimensionamento uniforme, utilizzare QSGTexture::Linear; per un ridimensionamento normale, utilizzare QSGTexture::Nearest.
Vedi anche filtering().
void QSGSimpleTextureNode::setOwnsTexture(bool owns)
Imposta se il nodo acquisisce la proprietà della texture su owns.
Per impostazione predefinita, il nodo non assume la proprietà della texture.
Vedi anche ownsTexture() e setTexture().
void QSGSimpleTextureNode::setRect(const QRectF &r)
Imposta il rettangolo di destinazione di questo nodo texture su r.
Vedi anche rect().
void QSGSimpleTextureNode::setRect(qreal x, qreal y, qreal w, qreal h)
Imposta il rettangolo di questo nodo texture in modo che abbia come punto di partenza (x, y) e una larghezza di w e un'altezza di h.
Si tratta di una funzione sovraccaricata.
void QSGSimpleTextureNode::setSourceRect(const QRectF &r)
Imposta il rettangolo sorgente di questo nodo texture su r.
Vedi anche sourceRect().
void QSGSimpleTextureNode::setSourceRect(qreal x, qreal y, qreal w, qreal h)
Imposta il rettangolo di questo nodo di texture in modo che mostri la sua texture a partire da (x, y) e abbia larghezza w e altezza h rispetto a QSGTexture::textureSize.
Si tratta di una funzione sovraccaricata.
void QSGSimpleTextureNode::setTexture(QSGTexture *texture)
Imposta la texture di questo nodo texture su texture.
Utilizzare setOwnsTexture() per stabilire se il nodo debba assumere la proprietà della texture. Per impostazione predefinita, il nodo non ne assume la proprietà.
Attenzione: un nodo texture deve disporre di una texture prima di essere aggiunto allo scenegraph per poter essere renderizzato.
Vedi anche ` texture()`.
void QSGSimpleTextureNode::setTextureCoordinatesTransform(QSGSimpleTextureNode::TextureCoordinatesTransformMode mode)
Imposta il metodo utilizzato per generare le coordinate di texture su ` mode`. Questa opzione può essere utilizzata per ottenere il corretto orientamento della texture. È solitamente necessaria quando si utilizza una libreria OpenGL di terze parti per il rendering su texture, poiché OpenGL presenta un asse y invertito rispetto a ` Qt Quick`.
Vedi anche textureCoordinatesTransform().
QRectF QSGSimpleTextureNode::sourceRect() const
Restituisce il rettangolo sorgente di questo nodo texture.
Vedi anche setSourceRect().
QSGTexture *QSGSimpleTextureNode::texture() const
Restituisce la texture associata a questo nodo texture
Vedi anche setTexture().
QSGSimpleTextureNode::TextureCoordinatesTransformMode QSGSimpleTextureNode::textureCoordinatesTransform() const
Restituisce la modalità utilizzata per generare le coordinate di texture per questo nodo.
Vedi anche 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.