<?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>QAbstractAnimation 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">QAbstractAnimation Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QAbstractAnimation class is the base of all animations. <a href="#details">More...</a></p> <p>Inherits <a href="qobject.html">QObject</a>.</p><p>Inherited by <a href="qanimationgroup.html">QAnimationGroup</a>, <a href="qpauseanimation.html">QPauseAnimation</a> and <a href="qvariantanimation.html">QVariantAnimation</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qabstractanimation.html#DeletionPolicy-enum">DeletionPolicy</a></b> { KeepWhenStopped, DeleteWhenStopped }</li><li><div class="fn" />enum <b><a href="qabstractanimation.html#Direction-enum">Direction</a></b> { Forward, Backward }</li><li><div class="fn" />enum <b><a href="qabstractanimation.html#State-enum">State</a></b> { Stopped, Paused, Running }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractanimation.html#QAbstractAnimation">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" />int <b><a href="qabstractanimation.html#currentLoop">currentLoop</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractanimation.html#currentLoopTime">currentLoopTime</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractanimation.html#currentTime">currentTime</a></b> (<i>self</i>)</li><li><div class="fn" />Direction <b><a href="qabstractanimation.html#direction">direction</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractanimation.html#duration">duration</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractanimation.html#event">event</a></b> (<i>self</i>, QEvent <i>event</i>)</li><li><div class="fn" />QAnimationGroup <b><a href="qabstractanimation.html#group">group</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractanimation.html#loopCount">loopCount</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractanimation.html#pause">pause</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractanimation.html#resume">resume</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractanimation.html#setCurrentTime">setCurrentTime</a></b> (<i>self</i>, int <i>msecs</i>)</li><li><div class="fn" /><b><a href="qabstractanimation.html#setDirection">setDirection</a></b> (<i>self</i>, Direction <i>direction</i>)</li><li><div class="fn" /><b><a href="qabstractanimation.html#setLoopCount">setLoopCount</a></b> (<i>self</i>, int <i>loopCount</i>)</li><li><div class="fn" /><b><a href="qabstractanimation.html#setPaused">setPaused</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qabstractanimation.html#start">start</a></b> (<i>self</i>, DeletionPolicy <i>policy</i> = QAbstractAnimation.KeepWhenStopped)</li><li><div class="fn" />State <b><a href="qabstractanimation.html#state">state</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractanimation.html#stop">stop</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractanimation.html#totalDuration">totalDuration</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractanimation.html#updateCurrentTime">updateCurrentTime</a></b> (<i>self</i>, int <i>currentTime</i>)</li><li><div class="fn" /><b><a href="qabstractanimation.html#updateDirection">updateDirection</a></b> (<i>self</i>, Direction <i>direction</i>)</li><li><div class="fn" /><b><a href="qabstractanimation.html#updateState">updateState</a></b> (<i>self</i>, State <i>newState</i>, State <i>oldState</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qabstractanimation.html#currentLoopChanged">currentLoopChanged</a></b> (int)</li><li><div class="fn" />void <b><a href="qabstractanimation.html#directionChanged">directionChanged</a></b> (QAbstractAnimation::Direction)</li><li><div class="fn" />void <b><a href="qabstractanimation.html#finished">finished</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractanimation.html#stateChanged">stateChanged</a></b> (QAbstractAnimation::State,QAbstractAnimation::State)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractAnimation class is the base of all animations.</p> <p>The class defines the functions for the functionality shared by all animations. By inheriting this class, you can create custom animations that plug into the rest of the animation framework.</p> <p>The progress of an animation is given by its current time (<a href="qabstractanimation.html#currentLoopTime">currentLoopTime</a>()), which is measured in milliseconds from the start of the animation (0) to its end (<a href="qabstractanimation.html#duration-prop">duration</a>()). The value is updated automatically while the animation is running. It can also be set directly with <a href="qabstractanimation.html#currentTime-prop">setCurrentTime</a>().</p> <p>At any point an animation is in one of three states: <a href="qabstractanimation.html#State-enum">Running</a>, <a href="qabstractanimation.html#State-enum">Stopped</a>, or <a href="qabstractanimation.html#State-enum">Paused</a>--as defined by the <a href="qabstractanimation.html#State-enum">State</a> enum. The current state can be changed by calling <a href="qabstractanimation.html#start">start</a>(), <a href="qabstractanimation.html#stop">stop</a>(), <a href="qabstractanimation.html#pause">pause</a>(), or <a href="qabstractanimation.html#resume">resume</a>(). An animation will always reset its <a href="qabstractanimation.html#currentTime-prop">current time</a> when it is started. If paused, it will continue with the same current time when resumed. When an animation is stopped, it cannot be resumed, but will keep its current time (until started again). QAbstractAnimation will emit <a href="qabstractanimation.html#stateChanged">stateChanged</a>() whenever its state changes.</p> <p>An animation can loop any number of times by setting the <a href="qabstractanimation.html#loopCount-prop">loopCount</a> property. When an animation's current time reaches its <a href="qabstractanimation.html#duration-prop">duration</a>(), it will reset the current time and keep running. A loop count of 1 (the default value) means that the animation will run one time. Note that a duration of -1 means that the animation will run until stopped; the current time will increase indefinitely. When the current time equals <a href="qabstractanimation.html#duration-prop">duration</a>() and the animation is in its final loop, the <a href="qabstractanimation.html#State-enum">Stopped</a> state is entered, and the <a href="qabstractanimation.html#finished">finished</a>() signal is emitted.</p> <p>QAbstractAnimation provides pure virtual functions used by subclasses to track the progress of the animation: <a href="qabstractanimation.html#duration-prop">duration</a>() and <a href="qabstractanimation.html#updateCurrentTime">updateCurrentTime</a>(). The <a href="qabstractanimation.html#duration-prop">duration</a>() function lets you report a duration for the animation (as discussed above). The animation framework calls <a href="qabstractanimation.html#updateCurrentTime">updateCurrentTime</a>() when current time has changed. By reimplementing this function, you can track the animation progress. Note that neither the interval between calls nor the number of calls to this function are defined; though, it will normally be 60 updates per second.</p> <p>By reimplementing <a href="qabstractanimation.html#updateState">updateState</a>(), you can track the animation's state changes, which is particularly useful for animations that are not driven by time.</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="DeletionPolicy-enum" />QAbstractAnimation.DeletionPolicy</h3><table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"> <tt>QAbstractAnimation.KeepWhenStopped</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">The animation will not be deleted when stopped.</td> </tr> <tr> <td class="topAlign"> <tt>QAbstractAnimation.DeleteWhenStopped</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">The animation will be automatically deleted when stopped.</td> </tr> </table> <h3 class="fn"><a name="Direction-enum" />QAbstractAnimation.Direction</h3><p>This enum describes the direction of the animation when in <a href="qabstractanimation.html#State-enum">Running</a> state.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QAbstractAnimation.Forward</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">The current time of the animation increases with time (i.e., moves from 0 and towards the end / duration).</td> </tr> <tr> <td class="topAlign"><tt>QAbstractAnimation.Backward</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">The current time of the animation decreases with time (i.e., moves from the end / duration and towards 0).</td> </tr> </table> <p><b>See also</b> <a href="qabstractanimation.html#direction-prop">direction</a>.</p> <h3 class="fn"><a name="State-enum" />QAbstractAnimation.State</h3><p>This enum describes the state of the animation.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QAbstractAnimation.Stopped</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">The animation is not running. This is the initial state of <a href="qabstractanimation.html">QAbstractAnimation</a>, and the state <a href="qabstractanimation.html">QAbstractAnimation</a> reenters when finished. The current time remain unchanged until either <a href="qabstractanimation.html#currentTime-prop">setCurrentTime</a>() is called, or the animation is started by calling <a href="qabstractanimation.html#start">start</a>().</td> </tr> <tr> <td class="topAlign"><tt>QAbstractAnimation.Paused</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">The animation is paused (i.e., temporarily suspended). Calling <a href="qabstractanimation.html#resume">resume</a>() will resume animation activity.</td> </tr> <tr> <td class="topAlign"><tt>QAbstractAnimation.Running</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">The animation is running. While control is in the event loop, <a href="qabstractanimation.html">QAbstractAnimation</a> will update its current time at regular intervals, calling <a href="qabstractanimation.html#updateCurrentTime">updateCurrentTime</a>() when appropriate.</td> </tr> </table> <p><b>See also</b> <a href="qabstractanimation.html#state-prop">state</a>() and <a href="qabstractanimation.html#stateChanged">stateChanged</a>().</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractAnimation" />QAbstractAnimation.__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>Constructs the <a href="qabstractanimation.html">QAbstractAnimation</a> base class, and passes <i>parent</i> to <a href="qobject.html">QObject</a>'s constructor.</p> <p><b>See also</b> <a href="qvariantanimation.html">QVariantAnimation</a> and <a href="qanimationgroup.html">QAnimationGroup</a>.</p> <h3 class="fn"><a name="currentLoop" />int QAbstractAnimation.currentLoop (<i>self</i>)</h3><h3 class="fn"><a name="currentLoopTime" />int QAbstractAnimation.currentLoopTime (<i>self</i>)</h3><p>Returns the current time inside the current loop. It can go from 0 to <a href="qabstractanimation.html#duration-prop">duration</a>().</p> <p><b>See also</b> <a href="qabstractanimation.html#duration-prop">duration</a>() and <a href="qabstractanimation.html#currentTime-prop">currentTime</a>.</p> <h3 class="fn"><a name="currentTime" />int QAbstractAnimation.currentTime (<i>self</i>)</h3><h3 class="fn"><a name="direction" /><a href="qabstractanimation.html#Direction-enum">Direction</a> QAbstractAnimation.direction (<i>self</i>)</h3><h3 class="fn"><a name="duration" />int QAbstractAnimation.duration (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><h3 class="fn"><a name="event" />bool QAbstractAnimation.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="group" /><a href="qanimationgroup.html">QAnimationGroup</a> QAbstractAnimation.group (<i>self</i>)</h3><p>If this animation is part of a <a href="qanimationgroup.html">QAnimationGroup</a>, this function returns a pointer to the group; otherwise, it returns 0.</p> <p><b>See also</b> <a href="qanimationgroup.html#addAnimation">QAnimationGroup.addAnimation</a>().</p> <h3 class="fn"><a name="loopCount" />int QAbstractAnimation.loopCount (<i>self</i>)</h3><h3 class="fn"><a name="pause" />QAbstractAnimation.pause (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void pause()</tt>.</p><p>Pauses the animation. When the animation is paused, <a href="qabstractanimation.html#state-prop">state</a>() returns Paused. The value of <a href="qabstractanimation.html#currentTime-prop">currentTime</a> will remain unchanged until <a href="qabstractanimation.html#resume">resume</a>() or <a href="qabstractanimation.html#start">start</a>() is called. If you want to continue from the current time, call <a href="qabstractanimation.html#resume">resume</a>().</p> <p><b>See also</b> <a href="qabstractanimation.html#start">start</a>(), <a href="qabstractanimation.html#state-prop">state</a>(), and <a href="qabstractanimation.html#resume">resume</a>().</p> <h3 class="fn"><a name="resume" />QAbstractAnimation.resume (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void resume()</tt>.</p><p>Resumes the animation after it was paused. When the animation is resumed, it emits the resumed() and <a href="qabstractanimation.html#stateChanged">stateChanged</a>() signals. The currenttime is not changed.</p> <p><b>See also</b> <a href="qabstractanimation.html#start">start</a>(), <a href="qabstractanimation.html#pause">pause</a>(), and <a href="qabstractanimation.html#state-prop">state</a>().</p> <h3 class="fn"><a name="setCurrentTime" />QAbstractAnimation.setCurrentTime (<i>self</i>, int <i>msecs</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setCurrentTime(int)</tt>.</p><h3 class="fn"><a name="setDirection" />QAbstractAnimation.setDirection (<i>self</i>, <a href="qabstractanimation.html#Direction-enum">Direction</a> <i>direction</i>)</h3><h3 class="fn"><a name="setLoopCount" />QAbstractAnimation.setLoopCount (<i>self</i>, int <i>loopCount</i>)</h3><h3 class="fn"><a name="setPaused" />QAbstractAnimation.setPaused (<i>self</i>, bool)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setPaused(bool)</tt>.</p><p>If <i>paused</i> is true, the animation is paused. If <i>paused</i> is false, the animation is resumed.</p> <p><b>See also</b> <a href="qabstractanimation.html#state-prop">state</a>(), <a href="qabstractanimation.html#pause">pause</a>(), and <a href="qabstractanimation.html#resume">resume</a>().</p> <h3 class="fn"><a name="start" />QAbstractAnimation.start (<i>self</i>, <a href="qabstractanimation.html#DeletionPolicy-enum">DeletionPolicy</a> <i>policy</i> = QAbstractAnimation.KeepWhenStopped)</h3><p>This method is also a Qt slot with the C++ signature <tt>void start(QAbstractAnimation::DeletionPolicy = QAbstractAnimation.KeepWhenStopped)</tt>.</p><p>Starts the animation. The <i>policy</i> argument says whether or not the animation should be deleted when it's done. When the animation starts, the <a href="qabstractanimation.html#stateChanged">stateChanged</a>() signal is emitted, and <a href="qabstractanimation.html#state-prop">state</a>() returns Running. When control reaches the event loop, the animation will run by itself, periodically calling <a href="qabstractanimation.html#updateCurrentTime">updateCurrentTime</a>() as the animation progresses.</p> <p>If the animation is currently stopped or has already reached the end, calling start() will rewind the animation and start again from the beginning. When the animation reaches the end, the animation will either stop, or if the loop level is more than 1, it will rewind and continue from the beginning.</p> <p>If the animation is already running, this function does nothing.</p> <p><b>See also</b> <a href="qabstractanimation.html#stop">stop</a>() and <a href="qabstractanimation.html#state-prop">state</a>().</p> <h3 class="fn"><a name="state" /><a href="qabstractanimation.html#State-enum">State</a> QAbstractAnimation.state (<i>self</i>)</h3><h3 class="fn"><a name="stop" />QAbstractAnimation.stop (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void stop()</tt>.</p><p>Stops the animation. When the animation is stopped, it emits the <a href="qabstractanimation.html#stateChanged">stateChanged</a>() signal, and <a href="qabstractanimation.html#state-prop">state</a>() returns Stopped. The current time is not changed.</p> <p>If the animation stops by itself after reaching the end (i.e., <a href="qabstractanimation.html#currentLoopTime">currentLoopTime</a>() == <a href="qabstractanimation.html#duration-prop">duration</a>() and <a href="qabstractanimation.html#currentLoop-prop">currentLoop</a>() > <a href="qabstractanimation.html#loopCount-prop">loopCount</a>() - 1), the <a href="qabstractanimation.html#finished">finished</a>() signal is emitted.</p> <p><b>See also</b> <a href="qabstractanimation.html#start">start</a>() and <a href="qabstractanimation.html#state-prop">state</a>().</p> <h3 class="fn"><a name="totalDuration" />int QAbstractAnimation.totalDuration (<i>self</i>)</h3><p>Returns the total and effective duration of the animation, including the loop count.</p> <p><b>See also</b> <a href="qabstractanimation.html#duration-prop">duration</a>() and <a href="qabstractanimation.html#currentTime-prop">currentTime</a>.</p> <h3 class="fn"><a name="updateCurrentTime" />QAbstractAnimation.updateCurrentTime (<i>self</i>, int <i>currentTime</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This pure virtual function is called every time the animation's <i>currentTime</i> changes.</p> <p><b>See also</b> <a href="qabstractanimation.html#updateState">updateState</a>().</p> <h3 class="fn"><a name="updateDirection" />QAbstractAnimation.updateDirection (<i>self</i>, <a href="qabstractanimation.html#Direction-enum">Direction</a> <i>direction</i>)</h3><p>This virtual function is called by <a href="qabstractanimation.html">QAbstractAnimation</a> when the direction of the animation is changed. The <i>direction</i> argument is the new direction.</p> <p><b>See also</b> <a href="qabstractanimation.html#direction-prop">setDirection</a>() and <a href="qabstractanimation.html#direction-prop">direction</a>().</p> <h3 class="fn"><a name="updateState" />QAbstractAnimation.updateState (<i>self</i>, <a href="qabstractanimation.html#State-enum">State</a> <i>newState</i>, <a href="qabstractanimation.html#State-enum">State</a> <i>oldState</i>)</h3><p>This virtual function is called by <a href="qabstractanimation.html">QAbstractAnimation</a> when the state of the animation is changed from <i>oldState</i> to <i>newState</i>.</p> <p><b>See also</b> <a href="qabstractanimation.html#start">start</a>(), <a href="qabstractanimation.html#stop">stop</a>(), <a href="qabstractanimation.html#pause">pause</a>(), and <a href="qabstractanimation.html#resume">resume</a>().</p> <hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="currentLoopChanged" />void currentLoopChanged (int)</h3><p>This is the default overload of this signal.</p><p><a href="qabstractanimation.html">QAbstractAnimation</a> emits this signal whenever the current loop changes. <i>currentLoop</i> is the current loop.</p> <p><b>See also</b> <a href="qabstractanimation.html#currentLoop-prop">currentLoop</a>() and <a href="qabstractanimation.html#loopCount-prop">loopCount</a>().</p> <h3 class="fn"><a name="directionChanged" />void directionChanged (QAbstractAnimation::Direction)</h3><p>This is the default overload of this signal.</p><p><a href="qabstractanimation.html">QAbstractAnimation</a> emits this signal whenever the direction has been changed. <i>newDirection</i> is the new direction.</p> <p><b>See also</b> <a href="qabstractanimation.html#direction-prop">direction</a>.</p> <h3 class="fn"><a name="finished" />void finished ()</h3><p>This is the default overload of this signal.</p><p><a href="qabstractanimation.html">QAbstractAnimation</a> emits this signal after the animation has stopped and has reached the end.</p> <p>This signal is emitted after <a href="qabstractanimation.html#stateChanged">stateChanged</a>().</p> <p><b>See also</b> <a href="qabstractanimation.html#stateChanged">stateChanged</a>().</p> <h3 class="fn"><a name="stateChanged" />void stateChanged (QAbstractAnimation::State,QAbstractAnimation::State)</h3><p>This is the default overload of this signal.</p><p><a href="qabstractanimation.html">QAbstractAnimation</a> emits this signal whenever the state of the animation has changed from <i>oldState</i> to <i>newState</i>. This signal is emitted after the virtual <a href="qabstractanimation.html#updateState">updateState</a>() function is called.</p> <p><b>See also</b> <a href="qabstractanimation.html#updateState">updateState</a>().</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>