Results 1 to 1 of 1

Thread: QWebView local web page with remote images

  1. #1
    Join Date
    Mar 2010
    Thanked 1 Time in 1 Post
    Qt products
    Unix/X11 Windows

    Default QWebView local web page with remote images

    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:
    Qt Code:
    1. class myWebView : public QWebView {
    2. ...
    4. void showInfo() {
    5. QString strHtml = loadPageFromRessource();
    7. // generates the absolute url to the image on the server
    8. QUrl urlImg = generateImageUrl();
    9. urlImage.setUserName("myUsername");
    10. urlImage.setPassword("myPassword");
    12. // replaces the "%%imgUrl%%" placeholder in the html code with the url of the image
    13. strHtml.replace("%%imgUrl%%", urlImge.toString());
    15. // I've also some images as resources. So the base url to the resources has to be set.
    16. setHtml(strHtml, QUrl(m_strBaseResoucesUrl));
    18. }
    20. }
    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
    Last edited by woodtluk; 21st October 2010 at 12:11.
    Using Qt 4.7
    Developping on Win 7 and XP
    Using Qt Creator, Eclipse and Visual Studio
    Target Platforms Win, Linux and soon OS X

Similar Threads

  1. Html page Display in QWebView
    By Tavit in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2010, 15:39
  2. QWebView problem to display the web page
    By ansar in forum Qt Programming
    Replies: 4
    Last Post: 2nd March 2010, 12:36
  3. Pass remote (web) images to QImage
    By NicholasSmith in forum Qt Programming
    Replies: 2
    Last Post: 25th August 2009, 22:00
  4. Can QTextBrowser display remote images?
    By golnaz in forum Newbie
    Replies: 1
    Last Post: 21st January 2009, 13:45
  5. Beesoft Tracer - remote/local debugging
    By piotrek in forum Qt-based Software
    Replies: 0
    Last Post: 2nd July 2007, 07:38


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.