Inherits Image
This element was introduced in Qt 4.7.
The AnimatedImage element extends the features of the Image element, providing a way to play animations stored as images containing a series of frames, such as those stored in GIF files.
Information about the current frame and totla length of the animation can be obtained using the currentFrame and frameCount properties. You can start, pause and stop the animation by changing the values of the playing and paused properties.
The full list of supported formats can be determined with QMovie::supportedFormats().
The following QML shows how to display an animated image and obtain information about its state, such as the current frame and total number of frames. The result is an animated image with a simple progress indicator underneath it.
import QtQuick 1.0 Rectangle { width: animation.width; height: animation.height + 8 AnimatedImage { id: animation; source: "animation.gif" } Rectangle { property int frames: animation.frameCount width: 4; height: 8 x: (animation.width - width) * animation.currentFrame / frames y: animation.height color: "red" } }
See also BorderImage and Image.
cache : bool |
Specifies whether the image should be cached. The default value is true. Setting cache to false is useful when dealing with large images, to make sure that they aren't cached at the expense of small 'ui element' images.
This property group was introduced in QtQuick 1.1.
currentFrame is the frame that is currently visible. By monitoring this property for changes, you can animate other items at the same time as the image.
frameCount is the number of frames in the animation. For some animation formats, frameCount is unknown and has a value of zero.
mirror : bool |
This property holds whether the image should be horizontally inverted (effectively displaying a mirrored image).
The default value is false.
This property group was introduced in QtQuick 1.1.
paused : bool |
This property holds whether the animated image is paused.
By default, this property is false. Set it to true when you want to pause the animation.
playing : bool |
This property holds whether the animated image is playing.
By default, this property is true, meaning that the animation will start playing immediately.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.