with the introduction of QImageWriter::formatForMimeType() and the related
QImageReader and QImageWriter methods the assumption that the image format
(plugin name) equals everything after the slash can be dismissed and
properly handled
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
bool foundFormat = data->hasFormat(mimeType);
if (!foundFormat) {
- QStringList imageFormats = imageWriteMimeFormats();
+ const QStringList imageFormats = imageWriteMimeFormats();
if (mimeType == QLatin1String("application/x-qt-image")) {
// check all supported image formats
foreach (const QString &it, imageFormats) {
QImage image = qvariant_cast<QImage>(o->data->imageData());
QBuffer buf(&result);
buf.open(QBuffer::WriteOnly);
- image.save(&buf, mimetype.mid(mimetype.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper());
+ image.save(&buf, QImageWriter::formatForMimeType(mimetype.toLatin1()));
}
return result;
}