PDA

View Full Version : WebView and tabWidget



maston
2nd September 2010, 07:18
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 :)

TJSonic
21st October 2010, 15:31
You have to subclass cookie class, create Cookie and QNetworkAccesManager and connect them to your web vew.


//So lets create 2 web views, cookie and NAM

#include <QNetworkAccessManager>
#include <QNetworkCookieJar>

cookie1= new Cookie(this);
acmngr= new QNetworkAccessManager(this);

web1= new QWebView(this);
web2= new QWebView(this);
cookie1->load();

web1->page()->setNetworkAccessManager(acmngr);
web1->page()->networkAccesAanager()->setCookieJar(cookie1);
web2->page()->setNetworkAccessManager(acmngr);
web2->page()->networkAccesAanager()->setCookieJar(cookie1);



After that you will be able not to lost your session in 2 different web Views!)