summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qmovie.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image/qmovie.cpp')
-rw-r--r--src/gui/image/qmovie.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp
index 09cd788c61..ba27fb355b 100644
--- a/src/gui/image/qmovie.cpp
+++ b/src/gui/image/qmovie.cpp
@@ -965,14 +965,16 @@ void QMovie::setScaledSize(const QSize &size)
QList<QByteArray> QMovie::supportedFormats()
{
QList<QByteArray> list = QImageReader::supportedImageFormats();
- QMutableListIterator<QByteArray> it(list);
+
QBuffer buffer;
buffer.open(QIODevice::ReadOnly);
- while (it.hasNext()) {
- QImageReader reader(&buffer, it.next());
- if (!reader.supportsAnimation())
- it.remove();
- }
+
+ const auto doesntSupportAnimation =
+ [&buffer](const QByteArray &format) {
+ return !QImageReader(&buffer, format).supportsAnimation();
+ };
+
+ list.erase(std::remove_if(list.begin(), list.end(), doesntSupportAnimation), list.end());
return list;
}