/*! Returns the list of MIME types supported by QImageWriter. Note that the QApplication instance must be created before this function is called. \sa supportedImageFormats(), QImageReader::supportedMimeTypes() */ QList<QByteArray> QImageWriter::supportedMimeTypes() { QList<QByteArray> mimeTypes; #ifndef QT_NO_IMAGEFORMAT_BMP mimeTypes << "image/bmp"; #endif #ifndef QT_NO_IMAGEFORMAT_PPM mimeTypes << "image/x-portable-bitmap"; mimeTypes << "image/x-portable-graymap"; mimeTypes << "image/x-portable-pixmap"; #endif #ifndef QT_NO_IMAGEFORMAT_XBM mimeTypes << "image/x-xbitmap"; #endif #ifndef QT_NO_IMAGEFORMAT_XPM mimeTypes << "image/x-xpixmap"; #endif #ifndef QT_NO_IMAGEFORMAT_PNG mimeTypes << "image/png"; #endif #ifndef QT_NO_IMAGEFORMAT_JPEG mimeTypes << "image/jpeg"; #endif #ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerMimeTypes(loader(), QImageIOPlugin::CanWrite, &mimeTypes); #endif // QT_NO_IMAGEFORMATPLUGIN std::sort(mimeTypes.begin(), mimeTypes.end()); mimeTypes.erase(std::unique(mimeTypes.begin(), mimeTypes.end()), mimeTypes.end()); return mimeTypes; }
QList<QByteArray> QImageReader::supportedMimeTypes() { QSet<QByteArray> mimeTypes; for (int i = 0; i < _qt_NumFormats; ++i) mimeTypes << _qt_BuiltInFormats[i].mimeType; #ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerMimeTypes(loader(), QImageIOPlugin::CanRead, &mimeTypes); #endif // QT_NO_IMAGEFORMATPLUGIN QList<QByteArray> sortedMimeTypes; for (QSet<QByteArray>::ConstIterator it = mimeTypes.constBegin(); it != mimeTypes.constEnd(); ++it) sortedMimeTypes << *it; qSort(sortedMimeTypes); return sortedMimeTypes; }