set handler format based on its name when format is detected from content

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-08-04 19:01:05 +03:00
parent 4c1996d542
commit 6d6efafa5d

View file

@ -156,16 +156,20 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
#endif
}
#ifdef QIMAGEREADER_DEBUG
if (handler) {
#ifdef QIMAGEREADER_DEBUG
qDebug() << "QImageReader::createReadHandler: using the built-in handler for" << form;
}
#endif
handler->setDevice(device);
handler->setFormat(form);
return handler;
}
#ifndef QT_NO_DEBUG
const qint64 devicepos = device->pos();
#endif
if (!handler && device && autoDetectImageFormat) {
if (device && autoDetectImageFormat) {
if (QPngHandler::canRead(device)) {
handler = new QPngHandler;
}
@ -202,9 +206,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
<< "built-in handler can read this data";
#endif
handler->setDevice(device);
if (!form.isEmpty()) {
handler->setFormat(form);
}
handler->setFormat(handler->name());
return handler;
}