<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qsgsimpletexturenode.cpp --> <title>QSGSimpleTextureNode Class | Qt Quick 5.12.6</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.12</td><td ><a href="qtquick-index.html">Qt Quick</a></td><td ><a href="qtquick-module.html">C++ Classes</a></td><td >QSGSimpleTextureNode</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.6 Reference Documentation</a></td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QSGSimpleTextureNode Class</h1> <!-- $$$QSGSimpleTextureNode-brief --> <p>The <a href="qsgsimpletexturenode.html">QSGSimpleTextureNode</a> class is provided for convenience to easily draw textured content using the QML scene graph. <a href="#details">More...</a></p> <!-- @@@QSGSimpleTextureNode --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QSGSimpleTextureNode></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += quick</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qsggeometrynode.html">QSGGeometryNode</a></td></tr></table></div><p><b>This class is obsolete.</b> It is provided to keep old source code working. We strongly advise against using it in new code.</p> <ul> <li><a href="qsgsimpletexturenode-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h2 id="public-types">Public Types</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#TextureCoordinatesTransformFlag-enum">TextureCoordinatesTransformFlag</a></b> { NoTransform, MirrorHorizontally, MirrorVertically }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#TextureCoordinatesTransformFlag-enum">TextureCoordinatesTransformMode</a></b></td></tr> </table></div> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#QSGSimpleTextureNode">QSGSimpleTextureNode</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#dtor.QSGSimpleTextureNode">~QSGSimpleTextureNode</a></b>() override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QSGTexture::Filtering </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#filtering">filtering</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#ownsTexture">ownsTexture</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#rect">rect</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#setFiltering">setFiltering</a></b>(QSGTexture::Filtering <i>filtering</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#setOwnsTexture">setOwnsTexture</a></b>(bool <i>owns</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#setRect">setRect</a></b>(const QRectF &<i>r</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#setRect-1">setRect</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#setSourceRect">setSourceRect</a></b>(const QRectF &<i>r</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#setSourceRect-1">setSourceRect</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#setTexture">setTexture</a></b>(QSGTexture *<i>texture</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#setTextureCoordinatesTransform">setTextureCoordinatesTransform</a></b>(QSGSimpleTextureNode::TextureCoordinatesTransformMode <i>mode</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#sourceRect">sourceRect</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QSGTexture *</td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#texture">texture</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QSGSimpleTextureNode::TextureCoordinatesTransformMode </td><td class="memItemRight bottomAlign"><b><a href="qsgsimpletexturenode.html#textureCoordinatesTransform">textureCoordinatesTransform</a></b>() const</td></tr> </table></div> <ul> <li class="fn">4 public functions inherited from <a href="qsggeometrynode.html#public-functions">QSGGeometryNode</a></li> <li class="fn">3 public functions inherited from <a href="qsgbasicgeometrynode.html#public-functions">QSGBasicGeometryNode</a></li> <li class="fn">20 public functions inherited from <a href="qsgnode.html#public-functions">QSGNode</a></li> </ul> <a name="details"></a> <!-- $$$QSGSimpleTextureNode-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qsgsimpletexturenode.html">QSGSimpleTextureNode</a> class is provided for convenience to easily draw textured content using the QML scene graph.</p> <p><b>Warning:</b> The simple texture node class must have a texture before being added to the scene graph to be rendered.</p> <p><b>Warning:</b> This utility class is only functional when running with the OpenGL or software backends of the Qt Quick scenegraph. For a proper cross-platform alternative prefer using <a href="qsgimagenode.html">QSGImageNode</a> via <a href="qquickwindow.html#createImageNode">QQuickWindow::createImageNode</a>() or <a href="qsgengine.html#createImageNode">QSGEngine::createImageNode</a>().</p> </div> <!-- @@@QSGSimpleTextureNode --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$TextureCoordinatesTransformFlag$$$NoTransform$$$MirrorHorizontally$$$MirrorVertically --> <h3 class="flags" id="TextureCoordinatesTransformFlag-enum"><a name="TextureCoordinatesTransformFlag-enum"></a>enum QSGSimpleTextureNode::<span class="name">TextureCoordinatesTransformFlag</span><br/>flags QSGSimpleTextureNode::<span class="name">TextureCoordinatesTransformMode</span></h3> <p>The TextureCoordinatesTransformFlag enum is used to specify the mode used to generate texture coordinates for a textured quad.</p> <div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><code>QSGSimpleTextureNode::NoTransform</code></td><td class="topAlign tblval"><code>0x00</code></td><td class="topAlign">Texture coordinates are oriented with window coordinates i.e. with origin at top-left.</td></tr> <tr><td class="topAlign"><code>QSGSimpleTextureNode::MirrorHorizontally</code></td><td class="topAlign tblval"><code>0x01</code></td><td class="topAlign">Texture coordinates are inverted in the horizontal axis with respect to window coordinates</td></tr> <tr><td class="topAlign"><code>QSGSimpleTextureNode::MirrorVertically</code></td><td class="topAlign tblval"><code>0x02</code></td><td class="topAlign">Texture coordinates are inverted in the vertical axis with respect to window coordinates</td></tr> </table></div> <p>The TextureCoordinatesTransformMode type is a typedef for <a href="">QFlags</a><TextureCoordinatesTransformFlag>. It stores an OR combination of TextureCoordinatesTransformFlag values.</p> <!-- @@@TextureCoordinatesTransformFlag --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QSGSimpleTextureNode[overload1]$$$QSGSimpleTextureNode --> <h3 class="fn" id="QSGSimpleTextureNode"><a name="QSGSimpleTextureNode"></a>QSGSimpleTextureNode::<span class="name">QSGSimpleTextureNode</span>()</h3> <p>Constructs a new simple texture node</p> <!-- @@@QSGSimpleTextureNode --> <!-- $$$~QSGSimpleTextureNode[overload1]$$$~QSGSimpleTextureNode --> <h3 class="fn" id="dtor.QSGSimpleTextureNode"><a name="dtor.QSGSimpleTextureNode"></a><code>[override virtual] </code>QSGSimpleTextureNode::<span class="name">~QSGSimpleTextureNode</span>()</h3> <p>Destroys the texture node</p> <!-- @@@~QSGSimpleTextureNode --> <!-- $$$filtering[overload1]$$$filtering --> <h3 class="fn" id="filtering"><a name="filtering"></a><span class="type"><a href="qsgtexture.html#Filtering-enum">QSGTexture::Filtering</a></span> QSGSimpleTextureNode::<span class="name">filtering</span>() const</h3> <p>Returns the filtering currently set on this texture node</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#setFiltering">setFiltering</a>().</p> <!-- @@@filtering --> <!-- $$$ownsTexture[overload1]$$$ownsTexture --> <h3 class="fn" id="ownsTexture"><a name="ownsTexture"></a><span class="type">bool</span> QSGSimpleTextureNode::<span class="name">ownsTexture</span>() const</h3> <p>Returns <code>true</code> if the node takes ownership of the texture; otherwise returns <code>false</code>.</p> <p>This function was introduced in Qt 5.4.</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#setOwnsTexture">setOwnsTexture</a>().</p> <!-- @@@ownsTexture --> <!-- $$$rect[overload1]$$$rect --> <h3 class="fn" id="rect"><a name="rect"></a><span class="type">QRectF</span> QSGSimpleTextureNode::<span class="name">rect</span>() const</h3> <p>Returns the target rect of this texture node.</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#setRect">setRect</a>().</p> <!-- @@@rect --> <!-- $$$setFiltering[overload1]$$$setFilteringQSGTexture::Filtering --> <h3 class="fn" id="setFiltering"><a name="setFiltering"></a><span class="type">void</span> QSGSimpleTextureNode::<span class="name">setFiltering</span>(<span class="type"><a href="qsgtexture.html#Filtering-enum">QSGTexture::Filtering</a></span> <i>filtering</i>)</h3> <p>Sets the filtering to be used for this texture node to <i>filtering</i>.</p> <p>For smooth scaling, use <a href="qsgtexture.html#Filtering-enum">QSGTexture::Linear</a>; for normal scaling, use <a href="qsgtexture.html#Filtering-enum">QSGTexture::Nearest</a>.</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#filtering">filtering</a>().</p> <!-- @@@setFiltering --> <!-- $$$setOwnsTexture[overload1]$$$setOwnsTexturebool --> <h3 class="fn" id="setOwnsTexture"><a name="setOwnsTexture"></a><span class="type">void</span> QSGSimpleTextureNode::<span class="name">setOwnsTexture</span>(<span class="type">bool</span> <i>owns</i>)</h3> <p>Sets whether the node takes ownership of the texture to <i>owns</i>.</p> <p>By default, the node does not take ownership of the texture.</p> <p>This function was introduced in Qt 5.4.</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#ownsTexture">ownsTexture</a>() and <a href="qsgsimpletexturenode.html#setTexture">setTexture</a>().</p> <!-- @@@setOwnsTexture --> <!-- $$$setRect[overload1]$$$setRectconstQRectF& --> <h3 class="fn" id="setRect"><a name="setRect"></a><span class="type">void</span> QSGSimpleTextureNode::<span class="name">setRect</span>(const <span class="type">QRectF</span> &<i>r</i>)</h3> <p>Sets the target rect of this texture node to <i>r</i>.</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#rect">rect</a>().</p> <!-- @@@setRect --> <!-- $$$setRect$$$setRectqrealqrealqrealqreal --> <h3 class="fn" id="setRect-1"><a name="setRect-1"></a><span class="type">void</span> QSGSimpleTextureNode::<span class="name">setRect</span>(<span class="type">qreal</span> <i>x</i>, <span class="type">qreal</span> <i>y</i>, <span class="type">qreal</span> <i>w</i>, <span class="type">qreal</span> <i>h</i>)</h3> <p>This is an overloaded function.</p> <p>Sets the rectangle of this texture node to begin at (<i>x</i>, <i>y</i>) and have width <i>w</i> and height <i>h</i>.</p> <!-- @@@setRect --> <!-- $$$setSourceRect[overload1]$$$setSourceRectconstQRectF& --> <h3 class="fn" id="setSourceRect"><a name="setSourceRect"></a><span class="type">void</span> QSGSimpleTextureNode::<span class="name">setSourceRect</span>(const <span class="type">QRectF</span> &<i>r</i>)</h3> <p>Sets the source rect of this texture node to <i>r</i>.</p> <p>This function was introduced in Qt 5.5.</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#sourceRect">sourceRect</a>().</p> <!-- @@@setSourceRect --> <!-- $$$setSourceRect$$$setSourceRectqrealqrealqrealqreal --> <h3 class="fn" id="setSourceRect-1"><a name="setSourceRect-1"></a><span class="type">void</span> QSGSimpleTextureNode::<span class="name">setSourceRect</span>(<span class="type">qreal</span> <i>x</i>, <span class="type">qreal</span> <i>y</i>, <span class="type">qreal</span> <i>w</i>, <span class="type">qreal</span> <i>h</i>)</h3> <p>This is an overloaded function.</p> <p>Sets the rectangle of this texture node to show its texture from (<i>x</i>, <i>y</i>) and have width <i>w</i> and height <i>h</i> relatively to the <a href="qsgtexture.html#textureSize">QSGTexture::textureSize</a>.</p> <p>This function was introduced in Qt 5.5.</p> <!-- @@@setSourceRect --> <!-- $$$setTexture[overload1]$$$setTextureQSGTexture* --> <h3 class="fn" id="setTexture"><a name="setTexture"></a><span class="type">void</span> QSGSimpleTextureNode::<span class="name">setTexture</span>(<span class="type"><a href="qsgtexture.html">QSGTexture</a></span> *<i>texture</i>)</h3> <p>Sets the texture of this texture node to <i>texture</i>.</p> <p>Use <a href="qsgsimpletexturenode.html#setOwnsTexture">setOwnsTexture</a>() to set whether the node should take ownership of the texture. By default, the node does not take ownership.</p> <p><b>Warning:</b> A texture node must have a texture before being added to the scenegraph to be rendered.</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#texture">texture</a>().</p> <!-- @@@setTexture --> <!-- $$$setTextureCoordinatesTransform[overload1]$$$setTextureCoordinatesTransformQSGSimpleTextureNode::TextureCoordinatesTransformMode --> <h3 class="fn" id="setTextureCoordinatesTransform"><a name="setTextureCoordinatesTransform"></a><span class="type">void</span> QSGSimpleTextureNode::<span class="name">setTextureCoordinatesTransform</span>(<span class="type"><a href="qsgsimpletexturenode.html#TextureCoordinatesTransformFlag-enum">QSGSimpleTextureNode::TextureCoordinatesTransformMode</a></span> <i>mode</i>)</h3> <p>Sets the method used to generate texture coordinates to <i>mode</i>. This can be used to obtain correct orientation of the texture. This is commonly needed when using a third party OpenGL library to render to texture as OpenGL has an inverted y-axis relative to Qt Quick.</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#textureCoordinatesTransform">textureCoordinatesTransform</a>().</p> <!-- @@@setTextureCoordinatesTransform --> <!-- $$$sourceRect[overload1]$$$sourceRect --> <h3 class="fn" id="sourceRect"><a name="sourceRect"></a><span class="type">QRectF</span> QSGSimpleTextureNode::<span class="name">sourceRect</span>() const</h3> <p>Returns the source rect of this texture node.</p> <p>This function was introduced in Qt 5.5.</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#setSourceRect">setSourceRect</a>().</p> <!-- @@@sourceRect --> <!-- $$$texture[overload1]$$$texture --> <h3 class="fn" id="texture"><a name="texture"></a><span class="type"><a href="qsgtexture.html">QSGTexture</a></span> *QSGSimpleTextureNode::<span class="name">texture</span>() const</h3> <p>Returns the texture for this texture node</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#setTexture">setTexture</a>().</p> <!-- @@@texture --> <!-- $$$textureCoordinatesTransform[overload1]$$$textureCoordinatesTransform --> <h3 class="fn" id="textureCoordinatesTransform"><a name="textureCoordinatesTransform"></a><span class="type"><a href="qsgsimpletexturenode.html#TextureCoordinatesTransformFlag-enum">QSGSimpleTextureNode::TextureCoordinatesTransformMode</a></span> QSGSimpleTextureNode::<span class="name">textureCoordinatesTransform</span>() const</h3> <p>Returns the mode used to generate texture coordinates for this node.</p> <p><b>See also </b><a href="qsgsimpletexturenode.html#setTextureCoordinatesTransform">setTextureCoordinatesTransform</a>().</p> <!-- @@@textureCoordinatesTransform --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> 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. </p> </div> </body> </html>