diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp index 2f02a33b09..3889b747db 100644 --- a/src/gui/image/qmovie.cpp +++ b/src/gui/image/qmovie.cpp @@ -161,6 +161,8 @@ This signal is emitted by QMovie when the error \a error occurred during playback. QMovie will stop the movie, and enter QMovie::NotRunning state. + + \sa lastError(), lastErrorString() */ /*! \fn void QMovie::finished() @@ -792,6 +794,8 @@ QImage QMovie::currentImage() const /*! Returns \c true if the movie is valid (e.g., the image data is readable and the image format is supported); otherwise returns \c false. + + For information about why the movie is not valid, see lastError(). */ bool QMovie::isValid() const { @@ -799,6 +803,29 @@ bool QMovie::isValid() const return d->isValid(); } +/*! + Returns the most recent error that occurred while attempting to read image data. + + \sa lastErrorString() +*/ +QImageReader::ImageReaderError QMovie::lastError() const +{ + Q_D(const QMovie); + return d->reader->error(); +} + +/*! + Returns a human-readable representation of the most recent error that occurred + while attempting to read image data. + + \sa lastError() +*/ +QString QMovie::lastErrorString() const +{ + Q_D(const QMovie); + return d->reader->errorString(); +} + /*! Returns the number of frames in the movie. diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h index 2b41e07dba..ab8ef82aa0 100644 --- a/src/gui/image/qmovie.h +++ b/src/gui/image/qmovie.h @@ -106,6 +106,8 @@ public: QPixmap currentPixmap() const; bool isValid() const; + QImageReader::ImageReaderError lastError() const; + QString lastErrorString() const; bool jumpToFrame(int frameNumber); int loopCount() const;