diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-03-15 17:52:01 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-04-14 09:10:34 +0000 |
commit | 6bf99726218df5e6a7fef7feed8dec87b2128594 (patch) | |
tree | c40a8e6ed9e53c60ccf1b5f8752f852046efd3db /src/gui/image/qmovie.cpp | |
parent | 01a4d09ef6e1fae0d9b9ab924e7f3fed001ad8c8 (diff) |
QMovie: Add lastError and lastErrorString getters
QMovie has an error signal, but it is not possible for users to
"catch" all errors, for instance, if they occur at construction time, and
furthermore, it may not be convenient to add interception of the signal
just to find out what the error was.
[ChangeLog][QtGui][QMovie] Added lastError and lastErrorString accessors,
as a convenience over connecting to the error() signal.
Change-Id: I9c6ef70694c67986ecd30b5dc1b321c4dfa5c315
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Diffstat (limited to 'src/gui/image/qmovie.cpp')
-rw-r--r-- | src/gui/image/qmovie.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
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 { @@ -800,6 +804,29 @@ bool QMovie::isValid() const } /*! + 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. Certain animation formats do not support this feature, in which |