<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qgraphicstransform.cpp --> <title>QGraphicsTransform Class | Qt Widgets 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="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QGraphicsTransform</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtwidgets-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-functions">Public Functions</a></li> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#protected-slots">Protected Slots</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">QGraphicsTransform Class</h1> <!-- $$$QGraphicsTransform-brief --> <p>The <a href="qgraphicstransform.html">QGraphicsTransform</a> class is an abstract base class for building advanced transformations on QGraphicsItems. <a href="#details">More...</a></p> <!-- @@@QGraphicsTransform --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QGraphicsTransform></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.6</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="qgraphicsrotation.html">QGraphicsRotation</a> and <a href="qgraphicsscale.html">QGraphicsScale</a></p> </td></tr></table></div><ul> <li><a href="qgraphicstransform-members.html">List of all members, including inherited members</a></li> <li><a href="qgraphicstransform-obsolete.html">Obsolete members</a></li> </ul> <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="qgraphicstransform.html#QGraphicsTransform">QGraphicsTransform</a></b>(QObject *<i>parent</i> = nullptr)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstransform.html#dtor.QGraphicsTransform">~QGraphicsTransform</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstransform.html#applyTo">applyTo</a></b>(QMatrix4x4 *<i>matrix</i>) const = 0</td></tr> </table></div> <ul> <li class="fn">31 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li> </ul> <a name="static-public-members"></a> <h2 id="static-public-members">Static Public Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstransform.html#staticMetaObject-var">staticMetaObject</a></b></td></tr> </table></div> <ul> <li class="fn">9 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li> </ul> <a name="protected-slots"></a> <h2 id="protected-slots">Protected Slots</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstransform.html#update">update</a></b>()</td></tr> </table></div> <h3>Additional Inherited Members</h3> <ul> <li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li> <li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li> <li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li> <li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li> </ul> <a name="details"></a> <!-- $$$QGraphicsTransform-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qgraphicstransform.html">QGraphicsTransform</a> class is an abstract base class for building advanced transformations on QGraphicsItems.</p> <p>As an alternative to <a href="qgraphicsitem.html#transform">QGraphicsItem::transform</a>, <a href="qgraphicstransform.html">QGraphicsTransform</a> lets you create and control advanced transformations that can be configured independently using specialized properties.</p> <p><a href="qgraphicsitem.html">QGraphicsItem</a> allows you to assign any number of <a href="qgraphicstransform.html">QGraphicsTransform</a> instances to one <a href="qgraphicsitem.html">QGraphicsItem</a>. Each <a href="qgraphicstransform.html">QGraphicsTransform</a> is applied in order, one at a time, to the <a href="qgraphicsitem.html">QGraphicsItem</a> it's assigned to.</p> <p><a href="qgraphicstransform.html">QGraphicsTransform</a> is particularly useful for animations. Whereas <a href="qgraphicsitem.html#setTransform">QGraphicsItem::setTransform</a>() lets you assign any transform directly to an item, there is no direct way to interpolate between two different transformations (e.g., when transitioning between two states, each for which the item has a different arbitrary transform assigned). Using <a href="qgraphicstransform.html">QGraphicsTransform</a> you can interpolate the property values of each independent transformation. The resulting operation is then combined into a single transform which is applied to <a href="qgraphicsitem.html">QGraphicsItem</a>.</p> <p>Transformations are computed in true 3D space using <a href="../qtgui/qmatrix4x4.html">QMatrix4x4</a>. When the transformation is applied to a <a href="qgraphicsitem.html">QGraphicsItem</a>, it will be projected back to a 2D <a href="../qtgui/qtransform.html">QTransform</a>. When multiple <a href="qgraphicstransform.html">QGraphicsTransform</a> objects are applied to a <a href="qgraphicsitem.html">QGraphicsItem</a>, all of the transformations are computed in true 3D space, with the projection back to 2D only occurring after the last <a href="qgraphicstransform.html">QGraphicsTransform</a> is applied. The exception to this is <a href="qgraphicsrotation.html">QGraphicsRotation</a>, which projects back to 2D after each rotation to preserve the perspective effect around the X and Y axes.</p> <p>If you want to create your own configurable transformation, you can create a subclass of <a href="qgraphicstransform.html">QGraphicsTransform</a> (or any or the existing subclasses), and reimplement the pure virtual <a href="qgraphicstransform.html#applyTo">applyTo</a>() function, which takes a pointer to a <a href="../qtgui/qmatrix4x4.html">QMatrix4x4</a>. Each operation you would like to apply should be exposed as properties (e.g., customTransform->setVerticalShear(2.5)). Inside you reimplementation of <a href="qgraphicstransform.html#applyTo">applyTo</a>(), you can modify the provided transform respectively.</p> <p><a href="qgraphicstransform.html">QGraphicsTransform</a> can be used together with <a href="qgraphicsitem.html#setTransform">QGraphicsItem::setTransform</a>(), <a href="qgraphicsitem.html#setRotation">QGraphicsItem::setRotation</a>(), and <a href="qgraphicsitem.html#setScale">QGraphicsItem::setScale</a>().</p> </div> <p><b>See also </b><a href="qgraphicsitem.html#transform">QGraphicsItem::transform</a>(), <a href="qgraphicsscale.html">QGraphicsScale</a>, and <a href="qgraphicsrotation.html">QGraphicsRotation</a>.</p> <!-- @@@QGraphicsTransform --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QGraphicsTransform[overload1]$$$QGraphicsTransformQObject* --> <h3 class="fn" id="QGraphicsTransform"><a name="QGraphicsTransform"></a>QGraphicsTransform::<span class="name">QGraphicsTransform</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = nullptr)</h3> <p>Constructs a new <a href="qgraphicstransform.html">QGraphicsTransform</a> with the given <i>parent</i>.</p> <!-- @@@QGraphicsTransform --> <!-- $$$~QGraphicsTransform[overload1]$$$~QGraphicsTransform --> <h3 class="fn" id="dtor.QGraphicsTransform"><a name="dtor.QGraphicsTransform"></a><code>[virtual] </code>QGraphicsTransform::<span class="name">~QGraphicsTransform</span>()</h3> <p>Destroys the graphics transform.</p> <!-- @@@~QGraphicsTransform --> <!-- $$$applyTo[overload1]$$$applyToQMatrix4x4* --> <h3 class="fn" id="applyTo"><a name="applyTo"></a><code>[pure virtual] </code><span class="type">void</span> QGraphicsTransform::<span class="name">applyTo</span>(<span class="type"><a href="../qtgui/qmatrix4x4.html">QMatrix4x4</a></span> *<i>matrix</i>) const</h3> <p>This pure virtual method has to be reimplemented in derived classes.</p> <p>It applies this transformation to <i>matrix</i>.</p> <p><b>See also </b><a href="qgraphicsitem.html#transform">QGraphicsItem::transform</a>() and <a href="../qtgui/qmatrix4x4.html#toTransform">QMatrix4x4::toTransform</a>().</p> <!-- @@@applyTo --> <!-- $$$update[overload1]$$$update --> <h3 class="fn" id="update"><a name="update"></a><code>[protected slot] </code><span class="type">void</span> QGraphicsTransform::<span class="name">update</span>()</h3> <p>Notifies that this transform operation has changed its parameters in such a way that <a href="qgraphicstransform.html#applyTo">applyTo</a>() will return a different result than before.</p> <p>When implementing you own custom graphics transform, you must call this function every time you change a parameter, to let <a href="qgraphicsitem.html">QGraphicsItem</a> know that its transformation needs to be updated.</p> <p><b>See also </b><a href="qgraphicstransform.html#applyTo">applyTo</a>().</p> <!-- @@@update --> </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>