I´m using a QTextBrowser to display an external html document (and its image resources) which is placed in the same directory as the application. Everything works fine except that images are not displayed properly. Instead of the actual picture there is a "missing image" icon.
I tried different image formats and Qt versions, without success.
If I type in the absolute file path of the image it is displayed fine. But that´s not what I´d like to do as I can´t share my application then.
This is the part which loads the html file into the textbrowser:
QFile file(QApplication::applicationDirPath().append("/test.html")); if(!file.open(QIODevice::ReadWrite|QIODevice::Text)) return; QTextStream in(&file); ui->textBrowser->setHtml(in.readAll()); file.close();
And this is my html document:
<!doctype html> <html> <img src="test.png"> <p>paragraph which contains some text</p> </html>
Does anybody has an idea why it doesn´t display the image?
Thanks in advance!