Results 1 to 2 of 2

Thread: [ask] reload a QWebPage

  1. #1
    Join Date
    Apr 2013
    Posts
    8
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo

    Default [ask] reload a QWebPage

    Hi all,

    I'm currently creating a widget program that construct html page using QWebView.
    Workflow of the code probably like this.
    1. Get HTML string from external site.
    2. find all <img> tag from that page using QRegExp.
    3. save all urls from img src and then replace it to local path (i.e. http://www.qtcentre.org/images/smilies/smile.png become /home/user/img/smile.png)
    4. set QWebView html source using setHtml()
    5. Download all images from saved urls and save it to local disk using QNetworkAccessManager.
    6. If all images successfully downloaded, reload QWebView.


    I managed to finish step 1-5, but I'm stuck at step 6.
    I didn't use QWebPage settings attribute to auto load images because I want all the images saved to local disk.
    I've tried webview->update(), webview->repaint(), webview->triggerPageAction(QWebPage::Reload, true) but there is no effect.
    My local image will be shown only if I reset its html source again using setHtml().

    Is there another way to reload my QWebView page so that my recently downloaded images will be shown directly with out resetting its html source?


    thank you

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: [ask] reload a QWebPage

    I am assuming you tried the obvious QWebView::reload()... I suspect that does nothing because it has no URL to reload from (having been loaded directly).

    Why do you need to void simply setting the same HTML again?

Similar Threads

  1. QLibrary, reload DLL
    By nomprenom in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2012, 18:53
  2. how do you reload a listView?
    By implor in forum Newbie
    Replies: 5
    Last Post: 16th May 2010, 22:21
  3. Unwanted downloads with QWebPage/QWebPage
    By ouekah in forum Newbie
    Replies: 6
    Last Post: 11th May 2010, 22:48
  4. Reload a Qt Plugin
    By bunjee in forum Qt Programming
    Replies: 3
    Last Post: 30th December 2009, 15:36
  5. Reload a QTableWidget
    By SailinShoes in forum Qt Programming
    Replies: 1
    Last Post: 18th March 2008, 11:40

Bookmarks

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.