[Solved] How to show image in html file with QTextBrowser?
-
Dear all,
I would like to load a html file which contains
< img src="http://www.test.com/image........>
image link.How can I show that image in QTextBrowser? It just show only unknown images...
Thanks
-
I try with this implementation, but not work.
What's wrong with that..?@QVariant TextBrowser::loadResource(int type, const QUrl &name)
{
if (type == QTextDocument::ImageResource){
QFile file(srcUrl.resolved(name).toLocalFile());
if (file.open(QIODevice::ReadOnly))
return file.readAll();
}
return QTextBrowser::loadResource(type,name);
}@ -
This is my implementation for QTextDocument it should work for QTextBrowser too.
@ QVariant loadResource(int type, const QUrl &name)
{
if (type == QTextDocument::ImageResource)
{
return QImage(name.toLocalFile());
}
return QTextDocument::loadResource(type, name);
}@ -
This is strange because this function does not need anything from QColor. Missing QImage plugins are not interrupting the build process. Maybe a missing include? I have just this one: @#include <QtGui>@
Appears this message during the program run or when you try to build the binary?
-
The anser has been given in the "new thread on that error":http://developer.qt.nokia.com/forums/viewthread/9997. Please discuss the error specific topics over there.