Results 1 to 2 of 2

Thread: WebView and tabWidget

  1. #1
    Join Date
    May 2010
    Posts
    22
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default WebView and tabWidget

    Hi.

    I have tabWidget with WebView.
    And when I delegate links to linkClicked signal, my app open new tab with new webview. But when i am logged in some page, and click link there new opened webView lost session and cookies, so i have to sign in again.

    Is any way to pass history with cookies to open new webkit with logged on page?

    Thanks

  2. #2
    Join Date
    Mar 2010
    Posts
    38
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default Re: WebView and tabWidget

    You have to subclass cookie class, create Cookie and QNetworkAccesManager and connect them to your web vew.
    Qt Code:
    1. //So lets create 2 web views, cookie and NAM
    2.  
    3. #include <QNetworkAccessManager>
    4. #include <QNetworkCookieJar>
    5.  
    6. cookie1= new Cookie(this);
    7. acmngr= new QNetworkAccessManager(this);
    8.  
    9. web1= new QWebView(this);
    10. web2= new QWebView(this);
    11. cookie1->load();
    12.  
    13. web1->page()->setNetworkAccessManager(acmngr);
    14. web1->page()->networkAccesAanager()->setCookieJar(cookie1);
    15. web2->page()->setNetworkAccessManager(acmngr);
    16. web2->page()->networkAccesAanager()->setCookieJar(cookie1);
    To copy to clipboard, switch view to plain text mode 
    After that you will be able not to lost your session in 2 different web Views!)
    Last edited by TJSonic; 21st October 2010 at 15:40.

Similar Threads

  1. webview from UI and mousepressevent
    By maston in forum Qt Programming
    Replies: 1
    Last Post: 1st September 2010, 12:58
  2. How to make webView editable?
    By isamert in forum Qt Programming
    Replies: 2
    Last Post: 14th July 2010, 09:14
  3. Webview different Win & Linux
    By wirasto in forum Qt Programming
    Replies: 1
    Last Post: 17th December 2009, 04:14
  4. WebView
    By mskzo in forum Qt Programming
    Replies: 7
    Last Post: 5th December 2008, 21:18
  5. webView
    By peace_comp in forum Qt Programming
    Replies: 1
    Last Post: 6th July 2008, 17:57

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.