Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

QWebPage setContent -> don't load images

$
0
0
Hello, I have a problem with the function “setContent”. I want to create a HTML page from different html files:     if(listnews.isEmpty()) {         htmlcontent.append("No news available!");     } else {         for(int i=0;i<listnews.count();i++) {             QFile file(newslocation+listnews.at(i));             file.open(QIODevice::ReadOnly);             htmlcontent.append(file.readAll());             file.close();             htmlcontent.append("<br><hr><br>");         }     } listnews is a QStringList with html-filenames in a folder newslocation on my harddrive. The html files has a refence to an image located in the directory newslocation as the html files. When I use now something like webpage->mainFrame()->setContent(htmlcontent,QString(),QUrl(newslocation)); I can see the text content without the images file. With     QFile file(newslocation+"index.html");     if(file.exists()) file.remove();     file.open(QIODevice::WriteOnly);     file.write(htmlcontent);     file.close();     webpage->mainFrame()->setUrl(QUrl(newslocation+"index.html")); I can see the images, but I have the problem, that I have to write a index.html file, what I don’t like to do. Is there a way to load the Content through the setContent function with loading the images in the folder newslocation ?

Viewing all articles
Browse latest Browse all 18427

Latest Images

Trending Articles



Latest Images