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.The relative paths don't work at all and If I type in the absolute file path of the image, it is displayed fine but a warning appears before the html document is loaded. The warning says "QFSEngine::open: No file specified" . i'm loading my html file using this snippet :
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 file:
<!doctype html>
<html>
<img src="test.png">
<p>paragraph which contains some text</p>
</html>
Am i going wrong in reading the html or is there anything i have to include in my cpp file?