fix: supportedImageFormats() should show sai as supported

This commit is contained in:
Gary Wang 2020-07-05 14:54:17 +08:00
parent a3392513e3
commit 914c270e87

View File

@ -41,6 +41,10 @@ bool SAIHandler::canRead(QIODevice *device)
QImageIOPlugin::Capabilities SAIPlugin::capabilities(QIODevice *device, const QByteArray &format) const QImageIOPlugin::Capabilities SAIPlugin::capabilities(QIODevice *device, const QByteArray &format) const
{ {
if (format == "sai") {
return Capabilities(CanRead);
}
if (!format.isEmpty()) { if (!format.isEmpty()) {
return {}; return {};
} }
@ -49,7 +53,11 @@ QImageIOPlugin::Capabilities SAIPlugin::capabilities(QIODevice *device, const QB
return {}; return {};
} }
return Capabilities(CanRead); Capabilities cap;
if (device->isReadable() && SAIHandler::canRead(device)) {
cap |= CanRead;
}
return cap;
} }
QImageIOHandler *SAIPlugin::create(QIODevice *device, const QByteArray &format) const QImageIOHandler *SAIPlugin::create(QIODevice *device, const QByteArray &format) const