Skip to content

PythonQt.Qt.QMovie

QMovie

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

This class is used to show simple animations without sound. If you want to display video and media content, use the Qt Multimedia multimedia framework instead.

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 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:

QLabel label;
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 Paused state and emit stateChanged(). If you call setPaused(false), QMovie will reenter 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.

Source: https://doc.qt.io/archives/qt-5.15/qmovie.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
CacheAll attribute Any (shared captured text)
CacheMode attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
CacheNone attribute Any (shared captured text)
MovieState attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
NotRunning attribute Any (shared captured text)
Paused attribute Any (shared captured text)
Running attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
backgroundColor function (self) -> Any X.backgroundColor() -> PythonQt.QtGui.QColor (shared captured text)
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
cacheMode attribute Any This property holds the movie's cache mode (shared captured text)
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
currentFrameNumber function (self) -> int X.currentFrameNumber() -> int (shared captured text)
currentImage function (self) -> Any X.currentImage() -> PythonQt.QtGui.QImage (shared captured text)
currentPixmap function (self) -> Any X.currentPixmap() -> PythonQt.QtGui.QPixmap (shared captured text)
customEvent function (self, event: Any) -> Any (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QMovie.destroyed; argument details are not documented.
device function (self) -> Any X.device() -> PythonQt.QtCore.QIODevice (shared captured text)
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
error function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QMovie.error; argument details are not documented.
event function (self, event: Any) -> bool X.event(event) -> bool (shared captured text)
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
fileName function (self) -> str X.fileName() -> str (shared captured text)
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
finished function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QMovie.finished; argument details are not documented.
format function (self) -> Any X.format() -> PythonQt.QtCore.QByteArray (shared captured text)
frameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QMovie.frameChanged; argument details are not documented.
frameCount function (self) -> int X.frameCount() -> int (shared captured text)
frameRect function (self) -> Any X.frameRect() -> PythonQt.QtCore.QRect (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isValid function (self) -> bool X.isValid() -> bool (shared captured text)
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
jumpToFrame function (self, frameNumber: int) -> bool X.jumpToFrame(frameNumber) -> bool (shared captured text)
jumpToNextFrame function (self) -> bool X.jumpToNextFrame() -> bool (shared captured text)
killTimer function (self, id: Any) -> Any (shared captured text)
loopCount function (self) -> int X.loopCount() -> int (shared captured text)
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
nextFrameDelay function (self) -> int X.nextFrameDelay() -> int (shared captured text)
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QMovie.objectNameChanged; argument details are not documented.
parent function (self) -> Any X.parent() -> PythonQt.private.QObject (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
resized function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QMovie.resized; argument details are not documented.
scaledSize function (self) -> Any X.scaledSize() -> PythonQt.QtCore.QSize (shared captured text)
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
setBackgroundColor function (self, color: Any) -> None For image formats that support it, this function sets the background color to color. (shared captured text)
setCacheMode function (self, mode: Any) -> None (shared captured text)
setDevice function (self, device: Any) -> None Sets the current device to device. (shared captured text)
setFileName function (self, fileName: str) -> None Sets the name of the file that [QMovie](https://doc.qt.io/archives/qt-5.15/qmovie.html) reads image data from, to fileName. (shared captured text)
setFormat function (self, format: Any) -> None Sets the format that [QMovie](https://doc.qt.io/archives/qt-5.15/qmovie.html) will use when decoding image data, to format. (shared captured text)
setObjectName function (self, name: Any) -> Any (shared captured text)
setParent function (self, parent: Any) -> Any (shared captured text)
setPaused function (self, paused: bool) -> None If paused is true, [QMovie](https://doc.qt.io/archives/qt-5.15/qmovie.html) will enter [Paused](https://doc.qt.io/archives/qt-5.15/qmovie.html#MovieState-enum) state and emit… (shared captured text)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setScaledSize function (self, size: Any) -> None Sets the scaled frame size to size. (shared captured text)
setSpeed function (self, percentSpeed: int) -> None (shared captured text)
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
speed attribute int This property holds the movie's speed (shared captured text)
start function (self) -> None Starts the movie. (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
started function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QMovie.started; argument details are not documented.
state function (self) -> Any Returns the current state of [QMovie](https://doc.qt.io/archives/qt-5.15/qmovie.html). (shared captured text)
stateChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QMovie.stateChanged; argument details are not documented.
stop function (self) -> None Stops the movie. (shared captured text)
supportedFormats function (self) -> Any Returns the list of image formats supported by [QMovie](https://doc.qt.io/archives/qt-5.15/qmovie.html). (shared captured text)
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
updated function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QMovie.updated; argument details are not documented.