Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QMovie Class Reference

\inmodule QtGui More...

#include <qmovie.h>

+ Inheritance diagram for QMovie:
+ Collaboration diagram for QMovie:

Public Types

enum  MovieState { NotRunning , Paused , Running }
 This enum describes the different states of QMovie. More...
 
enum  CacheMode { CacheNone , CacheAll }
 This enum describes the different cache modes of QMovie. More...
 

Public Slots

void start ()
 Starts the movie.
 
bool jumpToNextFrame ()
 Jumps to the next frame.
 
void setPaused (bool paused)
 If paused is true, QMovie will enter \l Paused state and emit stateChanged(Paused); otherwise it will enter \l Running state and emit stateChanged(Running).
 
void stop ()
 Stops the movie.
 
void setSpeed (int percentSpeed)
 
- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 

Signals

void started ()
 This signal is emitted after QMovie::start() has been called, and QMovie has entered QMovie::Running state.
 
void resized (const QSize &size)
 This signal is emitted when the current frame has been resized to size.
 
void updated (const QRect &rect)
 This signal is emitted when the rect rect in the current frame has been updated.
 
void stateChanged (QMovie::MovieState state)
 This signal is emitted every time the state of the movie changes.
 
void error (QImageReader::ImageReaderError error)
 This signal is emitted by QMovie when the error error occurred during playback.
 
void finished ()
 This signal is emitted when the movie has finished.
 
void frameChanged (int frameNumber)
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 

Public Member Functions

 QMovie (QObject *parent=nullptr)
 Constructs a QMovie object, passing the parent object to QObject's constructor.
 
 QMovie (QIODevice *device, const QByteArray &format=QByteArray(), QObject *parent=nullptr)
 Constructs a QMovie object.
 
 QMovie (const QString &fileName, const QByteArray &format=QByteArray(), QObject *parent=nullptr)
 Constructs a QMovie object.
 
 ~QMovie ()
 Destructs the QMovie object.
 
void setDevice (QIODevice *device)
 Sets the current device to device.
 
QIODevicedevice () const
 Returns the device QMovie reads image data from.
 
void setFileName (const QString &fileName)
 Sets the name of the file that QMovie reads image data from, to fileName.
 
QString fileName () const
 Returns the name of the file that QMovie reads image data from.
 
void setFormat (const QByteArray &format)
 Sets the format that QMovie will use when decoding image data, to format.
 
QByteArray format () const
 Returns the format that QMovie uses when decoding image data.
 
void setBackgroundColor (const QColor &color)
 For image formats that support it, this function sets the background color to color.
 
QColor backgroundColor () const
 Returns the background color of the movie.
 
MovieState state () const
 Returns the current state of QMovie.
 
QRect frameRect () const
 Returns the rect of the last frame.
 
QImage currentImage () const
 Returns the current frame as a QImage.
 
QPixmap currentPixmap () const
 Returns the current frame as a QPixmap.
 
bool isValid () const
 Returns true if the movie is valid (e.g., the image data is readable and the image format is supported); otherwise returns false.
 
QImageReader::ImageReaderError lastError () const
 Returns the most recent error that occurred while attempting to read image data.
 
QString lastErrorString () const
 Returns a human-readable representation of the most recent error that occurred while attempting to read image data.
 
bool jumpToFrame (int frameNumber)
 Jumps to frame number frameNumber.
 
int loopCount () const
 Returns the number of times the movie will loop before it finishes.
 
int frameCount () const
 Returns the number of frames in the movie.
 
int nextFrameDelay () const
 Returns the number of milliseconds QMovie will wait before updating the next frame in the animation.
 
int currentFrameNumber () const
 Returns the sequence number of the current frame.
 
int speed () const
 
QBindable< int > bindableSpeed ()
 
QSize scaledSize ()
 
void setScaledSize (const QSize &size)
 
CacheMode cacheMode () const
 
void setCacheMode (CacheMode mode)
 
QBindable< CacheModebindableCacheMode ()
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 

Static Public Member Functions

static QList< QByteArraysupportedFormats ()
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 

Properties

int speed
 the movie's speed
 
CacheMode cacheMode
 the movie's cache mode
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Additional Inherited Members

- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 

Detailed Description

\inmodule QtGui

The QMovie class is a convenience class for playing movies with QImageReader.

This class is used to show simple animations without sound.

First, create a QMovie object by passing either the name of a file or a pointer to a QIODevice containing an animated image format to QMovie's constructor. You can call isValid() to check if the image data is valid, before starting the movie. To start the movie, call start(). QMovie will enter \l Running state, and emit started() and stateChanged(). To get the current state of the movie, call state().

To display the movie in your application, you can pass your QMovie object to QLabel::setMovie(). Example:

QMovie *movie = new QMovie("animations/fire.gif");
label.setMovie(movie);
movie->start();

Whenever a new frame is available in the movie, QMovie will emit updated(). If the size of the frame changes, resized() is emitted. You can call currentImage() or currentPixmap() to get a copy of the current frame. When the movie is done, QMovie emits finished(). If any error occurs during playback (i.e, the image file is corrupt), QMovie will emit error().

You can control the speed of the movie playback by calling setSpeed(), which takes the percentage of the original speed as an argument. Pause the movie by calling setPaused(true). QMovie will then enter \l Paused state and emit stateChanged(). If you call setPaused(false), QMovie will reenter \l Running state and start the movie again. To stop the movie, call stop().

Certain animation formats allow you to set the background color. You can call setBackgroundColor() to set the color, or backgroundColor() to retrieve the current background color.

currentFrameNumber() returns the sequence number of the current frame. The first frame in the animation has the sequence number 0. frameCount() returns the total number of frames in the animation, if the image format supports this. You can call loopCount() to get the number of times the movie should loop before finishing. nextFrameDelay() returns the number of milliseconds the current frame should be displayed.

QMovie can be instructed to cache frames of an animation by calling setCacheMode().

Call supportedFormats() for a list of formats that QMovie supports.

See also
QLabel, QImageReader

Definition at line 27 of file qmovie.h.

Member Enumeration Documentation

◆ CacheMode

This enum describes the different cache modes of QMovie.

\value CacheNone No frames are cached (the default).

\value CacheAll All frames are cached.

Enumerator
CacheNone 
CacheAll 

Definition at line 40 of file qmovie.h.

◆ MovieState

This enum describes the different states of QMovie.

\value NotRunning The movie is not running. This is QMovie's initial state, and the state it enters after stop() has been called or the movie is finished.

\value Paused The movie is paused, and QMovie stops emitting updated() or resized(). This state is entered after calling pause() or setPaused(true). The current frame number it kept, and the movie will continue with the next frame when unpause() or setPaused(false) is called.

\value Running The movie is running.

Enumerator
NotRunning 
Paused 
Running 

Definition at line 34 of file qmovie.h.

Constructor & Destructor Documentation

◆ QMovie() [1/3]

QMovie::QMovie ( QObject * parent = nullptr)
explicit

Constructs a QMovie object, passing the parent object to QObject's constructor.

See also
setFileName(), setDevice(), setFormat()

Definition at line 574 of file qmovie.cpp.

References QObject::connect(), d, SIGNAL, and SLOT.

+ Here is the call graph for this function:

◆ QMovie() [2/3]

QMovie::QMovie ( QIODevice * device,
const QByteArray & format = QByteArray(),
QObject * parent = nullptr )
explicit

Constructs a QMovie object.

QMovie will use read image data from device, which it assumes is open and readable. If format is not empty, QMovie will use the image format format for decoding the image data. Otherwise, QMovie will attempt to guess the format.

The parent object is passed to QObject's constructor.

Definition at line 590 of file qmovie.cpp.

References QObject::connect(), d, device(), QIODevice::pos(), SIGNAL, and SLOT.

+ Here is the call graph for this function:

◆ QMovie() [3/3]

QMovie::QMovie ( const QString & fileName,
const QByteArray & format = QByteArray(),
QObject * parent = nullptr )
explicit

Constructs a QMovie object.

QMovie will use read image data from fileName. If format is not empty, QMovie will use the image format format for decoding the image data. Otherwise, QMovie will attempt to guess the format.

The parent object is passed to QObject's constructor.

Definition at line 607 of file qmovie.cpp.

References QDir::absolutePath(), QObject::connect(), d, fileName(), SIGNAL, and SLOT.

+ Here is the call graph for this function:

◆ ~QMovie()

QMovie::~QMovie ( )

Destructs the QMovie object.

Definition at line 621 of file qmovie.cpp.

References d.

Member Function Documentation

◆ backgroundColor()

QColor QMovie::backgroundColor ( ) const

Returns the background color of the movie.

If no background color has been assigned, an invalid QColor is returned.

See also
setBackgroundColor()

Definition at line 725 of file qmovie.cpp.

References d.

◆ bindableCacheMode()

QBindable< QMovie::CacheMode > QMovie::bindableCacheMode ( )

Definition at line 1057 of file qmovie.cpp.

References d.

◆ bindableSpeed()

QBindable< int > QMovie::bindableSpeed ( )

Definition at line 929 of file qmovie.cpp.

References d.

◆ cacheMode()

QMovie::CacheMode QMovie::cacheMode ( ) const

Definition at line 1045 of file qmovie.cpp.

References d.

◆ currentFrameNumber()

int QMovie::currentFrameNumber ( ) const

Returns the sequence number of the current frame.

The number of the first frame in the movie is 0.

Definition at line 837 of file qmovie.cpp.

References d.

Referenced by QQuickAnimatedImagePrivate::infoForCurrentFrame().

+ Here is the caller graph for this function:

◆ currentImage()

QImage QMovie::currentImage ( ) const

Returns the current frame as a QImage.

See also
currentPixmap(), updated()

Definition at line 770 of file qmovie.cpp.

References d.

Referenced by QQuickAnimatedImagePrivate::infoForCurrentFrame().

+ Here is the caller graph for this function:

◆ currentPixmap()

QPixmap QMovie::currentPixmap ( ) const

Returns the current frame as a QPixmap.

See also
currentImage(), updated()

Definition at line 759 of file qmovie.cpp.

References d.

◆ device()

QIODevice * QMovie::device ( ) const

Returns the device QMovie reads image data from.

If no device has currently been assigned, \nullptr is returned.

See also
setDevice(), fileName()

Definition at line 646 of file qmovie.cpp.

References d.

Referenced by QMovie(), and setDevice().

+ Here is the caller graph for this function:

◆ error

void QMovie::error ( QImageReader::ImageReaderError error)
signal

This signal is emitted by QMovie when the error error occurred during playback.

QMovie will stop the movie, and enter QMovie::NotRunning state.

See also
lastError(), lastErrorString()

◆ fileName()

QString QMovie::fileName ( ) const

Returns the name of the file that QMovie reads image data from.

If no file name has been assigned, or if the assigned device is not a file, an empty QString is returned.

See also
setFileName(), device()

Definition at line 673 of file qmovie.cpp.

References d.

Referenced by QMovie(), QQuickAnimatedImagePrivate::infoForCurrentFrame(), and setFileName().

+ Here is the caller graph for this function:

◆ finished

void QMovie::finished ( )
signal

This signal is emitted when the movie has finished.

See also
QMovie::stop()

◆ format()

QByteArray QMovie::format ( ) const

Returns the format that QMovie uses when decoding image data.

If no format has been assigned, an empty QByteArray() is returned.

See also
setFormat()

Definition at line 701 of file qmovie.cpp.

References d.

Referenced by supportedFormats().

+ Here is the caller graph for this function:

◆ frameChanged

void QMovie::frameChanged ( int frameNumber)
signal
Since
4.1

This signal is emitted when the frame number has changed to frameNumber. You can call currentImage() or currentPixmap() to get a copy of the frame.

◆ frameCount()

int QMovie::frameCount ( ) const

Returns the number of frames in the movie.

Certain animation formats do not support this feature, in which case 0 is returned.

Definition at line 817 of file qmovie.cpp.

References d.

◆ frameRect()

QRect QMovie::frameRect ( ) const

Returns the rect of the last frame.

If no frame has yet been updated, an invalid QRect is returned.

See also
currentImage(), currentPixmap()

Definition at line 748 of file qmovie.cpp.

References d.

◆ isValid()

bool QMovie::isValid ( ) const

Returns true if the movie is valid (e.g., the image data is readable and the image format is supported); otherwise returns false.

For information about why the movie is not valid, see lastError().

Definition at line 782 of file qmovie.cpp.

References d.

◆ jumpToFrame()

bool QMovie::jumpToFrame ( int frameNumber)

Jumps to frame number frameNumber.

Returns true on success; otherwise returns false.

Definition at line 856 of file qmovie.cpp.

References d.

◆ jumpToNextFrame

bool QMovie::jumpToNextFrame ( )
slot

Jumps to the next frame.

Returns true on success; otherwise returns false.

Definition at line 846 of file qmovie.cpp.

References d.

◆ lastError()

QImageReader::ImageReaderError QMovie::lastError ( ) const

Returns the most recent error that occurred while attempting to read image data.

See also
lastErrorString()

Definition at line 793 of file qmovie.cpp.

References d.

◆ lastErrorString()

QString QMovie::lastErrorString ( ) const

Returns a human-readable representation of the most recent error that occurred while attempting to read image data.

See also
lastError()

Definition at line 805 of file qmovie.cpp.

References d.

◆ loopCount()

int QMovie::loopCount ( ) const

Returns the number of times the movie will loop before it finishes.

If the movie will only play once (no looping), loopCount returns 0. If the movie loops forever, loopCount returns -1.

Note that, if the image data comes from a sequential device (e.g. a socket), QMovie can only loop the movie if the cacheMode is set to QMovie::CacheAll.

Definition at line 871 of file qmovie.cpp.

References d.

◆ nextFrameDelay()

int QMovie::nextFrameDelay ( ) const

Returns the number of milliseconds QMovie will wait before updating the next frame in the animation.

Definition at line 827 of file qmovie.cpp.

References d.

Referenced by setPaused(), and setSpeed().

+ Here is the caller graph for this function:

◆ resized

void QMovie::resized ( const QSize & size)
signal

This signal is emitted when the current frame has been resized to size.

This effect is sometimes used in animations as an alternative to replacing the frame. You can call currentImage() or currentPixmap() to get a copy of the updated frame.

◆ scaledSize()

QSize QMovie::scaledSize ( )
Since
4.1

Returns the scaled size of frames.

See also
QImageReader::scaledSize()

Definition at line 982 of file qmovie.cpp.

References d.

Referenced by QQuickAnimatedImagePrivate::infoForCurrentFrame().

+ Here is the caller graph for this function:

◆ setBackgroundColor()

void QMovie::setBackgroundColor ( const QColor & color)

For image formats that support it, this function sets the background color to color.

See also
backgroundColor()

Definition at line 713 of file qmovie.cpp.

References d.

◆ setCacheMode()

void QMovie::setCacheMode ( CacheMode mode)

Definition at line 1051 of file qmovie.cpp.

References cacheMode, and d.

◆ setDevice()

void QMovie::setDevice ( QIODevice * device)

Sets the current device to device.

QMovie will read image data from this device when the movie is running.

See also
device(), setFormat()

Definition at line 633 of file qmovie.cpp.

References d, and device().

+ Here is the call graph for this function:

◆ setFileName()

void QMovie::setFileName ( const QString & fileName)

Sets the name of the file that QMovie reads image data from, to fileName.

See also
fileName(), setDevice(), setFormat()

Definition at line 658 of file qmovie.cpp.

References QDir::absolutePath(), d, and fileName().

+ Here is the call graph for this function:

◆ setFormat()

void QMovie::setFormat ( const QByteArray & format)

Sets the format that QMovie will use when decoding image data, to format.

By default, QMovie will attempt to guess the format of the image data.

You can call supportedFormats() for the full list of formats QMovie supports.

See also
QImageReader::supportedImageFormats()

Definition at line 689 of file qmovie.cpp.

References d.

◆ setPaused

void QMovie::setPaused ( bool paused)
slot

If paused is true, QMovie will enter \l Paused state and emit stateChanged(Paused); otherwise it will enter \l Running state and emit stateChanged(Running).

See also
state()

Definition at line 884 of file qmovie.cpp.

References d, nextFrameDelay(), NotRunning, Paused, and Running.

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setScaledSize()

void QMovie::setScaledSize ( const QSize & size)
Since
4.1

Sets the scaled frame size to size.

See also
QImageReader::setScaledSize()

Definition at line 995 of file qmovie.cpp.

References d.

Referenced by QQuickAnimatedImagePrivate::setMovie().

+ Here is the caller graph for this function:

◆ setSpeed

void QMovie::setSpeed ( int percentSpeed)
slot

Definition at line 910 of file qmovie.cpp.

References d, nextFrameDelay(), and Running.

Referenced by src_gui_image_qmovie::wrapper1().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ speed()

int QMovie::speed ( ) const

Definition at line 923 of file qmovie.cpp.

References d.

◆ start

void QMovie::start ( )
slot

Starts the movie.

QMovie will enter \l Running state, and start emitting updated() and resized() as the movie progresses.

If QMovie is in the \l Paused state, this function is equivalent to calling setPaused(false). If QMovie is already in the \l Running state, this function does nothing.

See also
stop(), setPaused()

Definition at line 945 of file qmovie.cpp.

References d, NotRunning, Paused, and setPaused().

Referenced by src_gui_image_qmovie::wrapper0().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ started

void QMovie::started ( )
signal

This signal is emitted after QMovie::start() has been called, and QMovie has entered QMovie::Running state.

◆ state()

QMovie::MovieState QMovie::state ( ) const

Returns the current state of QMovie.

See also
MovieState, stateChanged()

Definition at line 736 of file qmovie.cpp.

References d.

◆ stateChanged

void QMovie::stateChanged ( QMovie::MovieState state)
signal

This signal is emitted every time the state of the movie changes.

The new state is specified by state.

See also
QMovie::state()

◆ stop

void QMovie::stop ( )
slot

Stops the movie.

QMovie enters \l NotRunning state, and stops emitting updated() and resized(). If start() is called again, the movie will restart from the beginning.

If QMovie is already in the \l NotRunning state, this function does nothing.

See also
start(), setPaused()

Definition at line 965 of file qmovie.cpp.

References d, and NotRunning.

◆ supportedFormats()

QList< QByteArray > QMovie::supportedFormats ( )
static
Since
4.1

Returns the list of image formats supported by QMovie.

See also
QImageReader::supportedImageFormats()

Definition at line 1008 of file qmovie.cpp.

References QImageIOHandler::Animation, format(), list, QBuffer::open(), QIODeviceBase::ReadOnly, QList< T >::removeIf(), QImageReader::supportedImageFormats(), and QImageReader::supportsOption().

+ Here is the call graph for this function:

◆ updated

void QMovie::updated ( const QRect & rect)
signal

This signal is emitted when the rect rect in the current frame has been updated.

You can call currentImage() or currentPixmap() to get a copy of the updated frame.

Property Documentation

◆ cacheMode

QMovie::cacheMode
readwrite

the movie's cache mode

Caching frames can be useful when the underlying animation format handler that QMovie relies on to decode the animation data does not support jumping to particular frames in the animation, or even "rewinding" the animation to the beginning (for looping). Furthermore, if the image data comes from a sequential device, it is not possible for the underlying animation handler to seek back to frames whose data has already been read (making looping altogether impossible).

To aid in such situations, a QMovie object can be instructed to cache the frames, at the added memory cost of keeping the frames in memory for the lifetime of the object.

By default, this property is set to \l CacheNone.

See also
QMovie::CacheMode

Definition at line 32 of file qmovie.h.

Referenced by setCacheMode().

◆ speed

QMovie::speed
readwrite

the movie's speed

The speed is measured in percentage of the original movie speed. The default speed is 100%. Example:

QMovie movie("racecar.gif");
movie.setSpeed(200); // 2x speed

Definition at line 31 of file qmovie.h.


The documentation for this class was generated from the following files: