Results 1 to 4 of 4

Thread: QWeb

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2012
    Posts
    47
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default QWeb

    1. how do you store cookies using QNetworkCookieJar, and maybe put inside a user folder?

    2. how does this QWebPage::history() works if im gonna show these history inside a text edit.?

    3. I have a Save Page option to save the page as html, and i set QWebSettings::enablePersistentStorage(Pathname), then how im gonna write the downloadlinktodisk code?

    Qt Code:
    1. QWebPage abc;
    2. abc.DownloadLinkToDisk; //not this
    To copy to clipboard, switch view to plain text mode 
    thx
    Last edited by ttimt; 15th December 2012 at 12:27. Reason: spelling corrections

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QWeb

    Quote Originally Posted by ttimt View Post
    1. how do you store cookies using QNetworkCookieJar, and maybe put inside a user folder?
    The documentation says "If you want to save the cookies, you should derive from this class and implement the saving to disk to your own storage format."
    So as suggested, derive from QNetworkCookieJar, implement either a save method or save in you class' destructor.


    Quote Originally Posted by ttimt View Post
    2. how does this QWebPage::history() works if im gonna show these history inside a text edit.?
    I think I don't understand that question. The QWebHistory object basically holds two lists: one of items that have information about pages you can go back to and one with information about pages you can go forward to.

    Quote Originally Posted by ttimt View Post
    3. I have a Save Page option to save the page as html, and i set QWebSettings::enablePersistentStorage(Pathname), then how im gonna write the downloadlinktodisk code?
    You connect to the dowloadRequested signal and then use QNetworkAccessManager API to actually perform the download.
    Persistant Storage is a totally different feature, not related to "save to disk" at all.

    Cheers,
    _

  3. #3
    Join Date
    Nov 2012
    Posts
    47
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QWeb

    2. The QWebHistory object basically holds two lists: one of items that have information about pages you can go back to and one with information about pages you can go forward to.
    So I will need to save all visited sites into a file and loads it if the user click "History" button?

    3. You connect to the dowloadRequested signal and then use QNetworkAccessManager API to actually perform the download.
    Persistant Storage is a totally different feature, not related to "save to disk" at all.

    can you please show the code? If the user click "Save Page", I went to the slot of this

    Qt Code:
    1. void on_Button_Clicked(){
    2.  
    3. //downloadRequested(QNetworkRequest)
    4. //QNetworkAccessManager *networkManager = ui->webView->url()
    5.  
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QWeb

    Quote Originally Posted by ttimt View Post
    So I will need to save all visited sites into a file and loads it if the user click "History" button?
    What do you want to achieve?


    Quote Originally Posted by ttimt View Post
    can you please show the code? If the user click "Save Page", I went to the slot of this
    Ah, save page is a button.

    Well, in the slot you do this
    Qt Code:
    1. QWebPage *webPage = ui->webView->page();
    2. QWebFrame *webFrame = webPage->mainFrame();
    3.  
    4. QString content = webFrame->toHtml();
    5. // content now contains the HTML of the loaded URL
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

Similar Threads

  1. QWeb
    By offline in forum Qt Programming
    Replies: 3
    Last Post: 7th April 2010, 10:03
  2. [QWeb] Auto fills forms and browse throw web pages?
    By flamaros in forum Qt Programming
    Replies: 0
    Last Post: 16th December 2009, 00:36

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
  •  
Qt is a trademark of The Qt Company.