From 914c270e87862059e17cddbbc82be114b1430749 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Sun, 5 Jul 2020 14:54:17 +0800 Subject: [PATCH] fix: supportedImageFormats() should show sai as supported --- imageformats/sai.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/imageformats/sai.cpp b/imageformats/sai.cpp index f55aaa1..f4ba082 100644 --- a/imageformats/sai.cpp +++ b/imageformats/sai.cpp @@ -41,6 +41,10 @@ bool SAIHandler::canRead(QIODevice *device) QImageIOPlugin::Capabilities SAIPlugin::capabilities(QIODevice *device, const QByteArray &format) const { + if (format == "sai") { + return Capabilities(CanRead); + } + if (!format.isEmpty()) { return {}; } @@ -49,7 +53,11 @@ QImageIOPlugin::Capabilities SAIPlugin::capabilities(QIODevice *device, const QB 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