Sunday, 15 July 2012

Why qt webkit can't load local image? -



Why qt webkit can't load local image? -

i loading html file qwebview:

<img src="/home/xxx/.config/xxx/chat_img/test.png" /> <img src="test.png" /> <img src="file://test.png" />

but nil gets displayed. if replace image src online image (external source), such http://domain.com/file.png displayed. want know why qwebview isn't loading local files? thanks.

i can't reproduce problem. tried create qwebview way:

#include <qapplication> #include <qwebview> #include <qwebframe> int main(int argc, char *argv[]) { qapplication app(argc, argv); qwebview view; view.page()->mainframe()->load(qurl::fromlocalfile(html_file)); view.show(); homecoming app.exec(); }

and both absolute path or uri (you missing slash) working:

<img src="/abs/path/to/image.jpg" /> <img src="file:///abs/path/to/image.jpg" />

qt webkit

No comments:

Post a Comment