/*! Returns the list of image formats supported by QImageWriter. By default, Qt can write the following formats: \table \header \li Format \li MIME type \li Description \row \li BMP \li image/bmp \li Windows Bitmap \row \li JPG \li image/jpeg \li Joint Photographic Experts Group \row \li PNG \li image/png \li Portable Network Graphics \row \li PBM \li image/x-portable-bitmap \li Portable Bitmap \row \li PGM \li image/x-portable-graymap \li Portable Graymap \row \li PPM \li image/x-portable-pixmap \li Portable Pixmap \row \li XBM \li image/x-xbitmap \li X11 Bitmap \row \li XPM \li image/x-xpixmap \li X11 Pixmap \endtable Reading and writing SVG files is supported through the \l{Qt SVG} module. The \l{Qt Image Formats} module provides support for additional image formats. Note that the QApplication instance must be created before this function is called. \sa setFormat(), QImageReader::supportedImageFormats(), QImageIOPlugin */ QList<QByteArray> QImageWriter::supportedImageFormats() { QList<QByteArray> formats; #ifndef QT_NO_IMAGEFORMAT_BMP formats << "bmp"; #endif #ifndef QT_NO_IMAGEFORMAT_PPM formats << "pbm" << "pgm" << "ppm"; #endif #ifndef QT_NO_IMAGEFORMAT_XBM formats << "xbm"; #endif #ifndef QT_NO_IMAGEFORMAT_XPM formats << "xpm"; #endif #ifndef QT_NO_IMAGEFORMAT_PNG formats << "png"; #endif #ifndef QT_NO_IMAGEFORMAT_JPEG formats << "jpg" << "jpeg"; #endif #ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerFormats(loader(), QImageIOPlugin::CanWrite, &formats); #endif // QT_NO_IMAGEFORMATPLUGIN std::sort(formats.begin(), formats.end()); formats.erase(std::unique(formats.begin(), formats.end()), formats.end()); return formats; }
QList<QByteArray> QImageReader::supportedImageFormats() { QSet<QByteArray> formats; for (int i = 0; i < _qt_NumFormats; ++i) formats << _qt_BuiltInFormats[i].extension; #ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerFormats(loader(), QImageIOPlugin::CanRead, &formats); #endif // QT_NO_IMAGEFORMATPLUGIN QList<QByteArray> sortedFormats; for (QSet<QByteArray>::ConstIterator it = formats.constBegin(); it != formats.constEnd(); ++it) sortedFormats << *it; qSort(sortedFormats); return sortedFormats; }