Decision
Until the bug has been closed, you can handle this situation, inheriting from QTextBrowser, and finishing the QTextBrowser :: loadResource handler. Then it turns out all by Feng Shui:
QVariant MyTextBrowser::loadResource(int type, const QUrl &url) { if (type == QTextDocument::ImageResource && url.scheme() == QLatin1String("data")) { QRegExp Rx("^image/[^;]+;base64,(.+)$"); if (Rx.indexIn(url.path())>=0) { QImage Image; if (Image.loadFromData(QByteArray::fromBase64(Rx.cap(1).toLatin1()))) return QVariant::fromValue(Image); } } return QTextBrowser::loadResource(type, url); }
Of course, regexp can be finished so that it also controls the type of image. But given the allegations from RFC2045:
Thus, it’s even if you’ve been using the image or xyz.
And the QImage :: loadFromData documentation:
Attempts to read the image using the format, eg, PNG or JPG. If you are not specifying the file format.
... I decided not to burden Regexp with control over image types, there is no special meaning.
The issue is resolved.