Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.0
-
None
-
2fe059c863377befdcf65084a07a7f4841beef0d
Description
According to the comment in the code, it's "hard":
QImageIOPlugin::Capabilities QSvgPlugin::capabilities(QIODevice *device, const QByteArray &format) const { //### canRead disabled for now because it's hard to detect // whether the file is actually svg without parsing it //if (device->isReadable() && QSvgIOHandler::canRead(device)) if (format == "svg") return Capabilities(CanRead); else return 0; ... }
Consequence is that SVGs cannot be read from non-files (eg. QNetworkReply). (QImage has a backdoor QIODevice access to the filename, but fortunately not the QNetworkReply::url().
QDeclarativeImageRequestHandler, and everyone else has to work around this bug. All SVGs start with <?xml ...><comments><svg ...>. This doesn't require "hard" parsing.
The main purpose of CanRead is to detect WHICH handler to use, not to give a totally authoritative "yes this is definitely this format". The PNG loader for example, which claim to be able to read most corrupted PNG files.
Blocks requirement QT-3128.
Attachments
Issue Links
- is required for
-
QTBUG-8984 [QML] Image SVG width: handling problems when binding
-
- Closed
-