Hi there
I've a QWebView that displays a local page (from resource). But there in the html code is a generated link that points to a image on a server. The server needs basic authorisation.
I do this:
class myWebView : public QWebView {
...
void showInfo() {
QString strHtml
= loadPageFromRessource
();
// generates the absolute url to the image on the server
QUrl urlImg
= generateImageUrl
();
urlImage.setUserName("myUsername");
urlImage.setPassword("myPassword");
// replaces the "%%imgUrl%%" placeholder in the html code with the url of the image
strHtml.replace("%%imgUrl%%", urlImge.toString());
// I've also some images as resources. So the base url to the resources has to be set.
setHtml
(strHtml,
QUrl(m_strBaseResoucesUrl
));
}
}
class myWebView : public QWebView {
...
void showInfo() {
QString strHtml = loadPageFromRessource();
// generates the absolute url to the image on the server
QUrl urlImg = generateImageUrl();
urlImage.setUserName("myUsername");
urlImage.setPassword("myPassword");
// replaces the "%%imgUrl%%" placeholder in the html code with the url of the image
strHtml.replace("%%imgUrl%%", urlImge.toString());
// I've also some images as resources. So the base url to the resources has to be set.
setHtml(strHtml, QUrl(m_strBaseResoucesUrl));
}
}
To copy to clipboard, switch view to plain text mode
But the image is not loaded. If I don't set the username and password there is a dummy image with a questionmark in the web view shown. If I set the username and password no immage at all is shown.
Any suggestions?
Thanks Luke
Bookmarks