summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimagewriter.cpp
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2018-01-25 15:18:07 +0300
committerAlexander Volkov <a.volkov@rusbitech.ru>2018-02-27 12:49:40 +0000
commit37217c57fa5595e7cdfd7e19f34de22848dfc370 (patch)
treed29b4ed6ff51edfaac44d3f83c9a312b9006c650 /src/gui/image/qimagewriter.cpp
parent32da9ae38969c2e4f01968401339433e7909eed8 (diff)
Introduce QImage{Reader,Writer}::imageFormatsForMimeType()
It can be used if, for example, you get an image MIME type from the user, and you want to find the appropriate format for loading or saving this image. Task-number: QTBUG-49714 Change-Id: Iae5a7e9d658d6c3d1cd750a8bbc279f1812f99df Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image/qimagewriter.cpp')
-rw-r--r--src/gui/image/qimagewriter.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index fd036da604..30ec224158 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -863,4 +863,21 @@ QList<QByteArray> QImageWriter::supportedMimeTypes()
return QImageReaderWriterHelpers::supportedMimeTypes(QImageReaderWriterHelpers::CanWrite);
}
+/*!
+ \since 5.12
+
+ Returns the list of image formats corresponding to \mimeType.
+
+ Note that the QGuiApplication instance must be created before this function is
+ called.
+
+ \sa supportedImageFormats(), supportedMimeTypes()
+*/
+
+QList<QByteArray> QImageWriter::imageFormatsForMimeType(const QByteArray &mimeType)
+{
+ return QImageReaderWriterHelpers::imageFormatsForMimeType(mimeType,
+ QImageReaderWriterHelpers::CanWrite);
+}
+
QT_END_NAMESPACE