<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QPropertyAnimation Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPropertyAnimation Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QPropertyAnimation class animates Qt properties <a href="#details">More...</a></p> <p>Inherits <a href="qvariantanimation.html">QVariantAnimation</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpropertyanimation.html#QPropertyAnimation">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qpropertyanimation.html#QPropertyAnimation-2">__init__</a></b> (<i>self</i>, QObject <i>target</i>, QByteArray <i>propertyName</i>, QObject <i>parent</i> = None)</li><li><div class="fn" />bool <b><a href="qpropertyanimation.html#event">event</a></b> (<i>self</i>, QEvent <i>event</i>)</li><li><div class="fn" />QByteArray <b><a href="qpropertyanimation.html#propertyName">propertyName</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpropertyanimation.html#setPropertyName">setPropertyName</a></b> (<i>self</i>, QByteArray <i>propertyName</i>)</li><li><div class="fn" /><b><a href="qpropertyanimation.html#setTargetObject">setTargetObject</a></b> (<i>self</i>, QObject <i>target</i>)</li><li><div class="fn" />QObject <b><a href="qpropertyanimation.html#targetObject">targetObject</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpropertyanimation.html#updateCurrentValue">updateCurrentValue</a></b> (<i>self</i>, QVariant <i>value</i>)</li><li><div class="fn" /><b><a href="qpropertyanimation.html#updateState">updateState</a></b> (<i>self</i>, QAbstractAnimation.State <i>newState</i>, QAbstractAnimation.State <i>oldState</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPropertyAnimation class animates Qt properties</p> <p>QPropertyAnimation interpolates over <a href="properties.html#qt-s-property-system">Qt properties</a>. As property values are stored in <a href="qvariant.html">QVariant</a>s, the class inherits <a href="qvariantanimation.html">QVariantAnimation</a>, and supports animation of the same <a href="qvariant.html#Type-enum">variant types</a> as its super class.</p> <p>A class declaring properties must be a <a href="qobject.html">QObject</a>. To make it possible to animate a property, it must provide a setter (so that QPropertyAnimation can set the property's value). Note that this makes it possible to animate many of Qt's widgets. Let's look at an example:</p> <pre class="cpp"> <span class="type">QPropertyAnimation</span> <span class="operator">*</span>animation <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QPropertyAnimation</span>(myWidget<span class="operator">,</span> <span class="string">"geometry"</span>); animation<span class="operator">-</span><span class="operator">></span><a href="qvariantanimation.html#duration-prop">setDuration</a>(<span class="number">10000</span>); animation<span class="operator">-</span><span class="operator">></span><a href="qvariantanimation.html#startValue-prop">setStartValue</a>(<span class="type"><a href="qrect.html">QRect</a></span>(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">30</span>)); animation<span class="operator">-</span><span class="operator">></span><a href="qvariantanimation.html#endValue-prop">setEndValue</a>(<span class="type"><a href="qrect.html">QRect</a></span>(<span class="number">250</span><span class="operator">,</span> <span class="number">250</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">30</span>)); animation<span class="operator">-</span><span class="operator">></span><a href="qabstractanimation.html#start">start</a>(); </pre> <p>The property name and the <a href="qobject.html">QObject</a> instance of which property should be animated are passed to the constructor. You can then specify the start and end value of the property. The procedure is equal for properties in classes you have implemented yourself--just check with <a href="qvariantanimation.html">QVariantAnimation</a> that your <a href="qvariant.html">QVariant</a> type is supported.</p> <p>The <a href="qvariantanimation.html">QVariantAnimation</a> class description explains how to set up the animation in detail. Note, however, that if a start value is not set, the property will start at the value it had when the QPropertyAnimation instance was created.</p> <p>QPropertyAnimation works like a charm on its own. For complex animations that, for instance, contain several objects, <a href="qanimationgroup.html">QAnimationGroup</a> is provided. An animation group is an animation that can contain other animations, and that can manage when its animations are played. Look at <a href="qparallelanimationgroup.html">QParallelAnimationGroup</a> for an example.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPropertyAnimation" />QPropertyAnimation.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Construct a <a href="qpropertyanimation.html">QPropertyAnimation</a> object. <i>parent</i> is passed to <a href="qobject.html">QObject</a>'s constructor.</p> <h3 class="fn"><a name="QPropertyAnimation-2" />QPropertyAnimation.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <i>target</i>, <a href="qbytearray.html">QByteArray</a> <i>propertyName</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Construct a <a href="qpropertyanimation.html">QPropertyAnimation</a> object. <i>parent</i> is passed to <a href="qobject.html">QObject</a>'s constructor. The animation changes the property <i>propertyName</i> on <i>target</i>. The default duration is 250ms.</p> <p><b>See also</b> <a href="qpropertyanimation.html#targetObject-prop">targetObject</a> and <a href="qpropertyanimation.html#propertyName-prop">propertyName</a>.</p> <h3 class="fn"><a name="event" />bool QPropertyAnimation.event (<i>self</i>, <a href="qevent.html">QEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p> <h3 class="fn"><a name="propertyName" /><a href="qbytearray.html">QByteArray</a> QPropertyAnimation.propertyName (<i>self</i>)</h3><h3 class="fn"><a name="setPropertyName" />QPropertyAnimation.setPropertyName (<i>self</i>, <a href="qbytearray.html">QByteArray</a> <i>propertyName</i>)</h3><h3 class="fn"><a name="setTargetObject" />QPropertyAnimation.setTargetObject (<i>self</i>, <a href="qobject.html">QObject</a> <i>target</i>)</h3><h3 class="fn"><a name="targetObject" /><a href="qobject.html">QObject</a> QPropertyAnimation.targetObject (<i>self</i>)</h3><h3 class="fn"><a name="updateCurrentValue" />QPropertyAnimation.updateCurrentValue (<i>self</i>, QVariant <i>value</i>)</h3><p>Reimplemented from <a href="qvariantanimation.html#updateCurrentValue">QVariantAnimation.updateCurrentValue</a>().</p> <p>This virtual function is called by <a href="qvariantanimation.html">QVariantAnimation</a> whenever the current value changes. <i>value</i> is the new, updated value. It updates the current value of the property on the target object.</p> <p><b>See also</b> <a href="qvariantanimation.html#currentValue-prop">currentValue</a> and <a href="qabstractanimation.html#currentTime-prop">currentTime</a>.</p> <h3 class="fn"><a name="updateState" />QPropertyAnimation.updateState (<i>self</i>, <a href="qabstractanimation.html#State-enum">QAbstractAnimation.State</a> <i>newState</i>, <a href="qabstractanimation.html#State-enum">QAbstractAnimation.State</a> <i>oldState</i>)</h3><p>Reimplemented from <a href="qabstractanimation.html#updateState">QAbstractAnimation.updateState</a>().</p> <p>If the <a href="qvariantanimation.html#startValue-prop">startValue</a> is not defined when the state of the animation changes from Stopped to Running, the current property value is used as the initial value for the animation.</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>