Can i make Qwebkit to open ( in tabs ) more then one QwebView or maybe something else. that each will hold its own cookies and will open its own session . i like to be able in the end open multiple emails and view them in one browser
2 Answers
QWebView doesn't handle cookies by its own. Instead that work is offloaded to the QNetworkAccessManager afferent to each QWebPage, though i don't currently know if QWebView sets the same QNeworkAccessManager for each QWebView or if it uses different ones, the latter might seem a bad approach tough.
You can use QWebPage::networkAccessManager () to grab the QNetworkAccessManager responsible for a QWebPage and QWebPage::setNetworkAccessManager to set it.
Use QNetworkAccessManager::cookieJar () to get a handle of the QNetworkCookieJar that takes care of cookies for a given QNetworkAccessManage.
Thus if you create different instances of QWebView or use different instances of QNetworkAccessManager directly and wisely you can create different browser views with different cookie sessions/jars and achieving the result you desire.

- 6,279
- 6
- 31
- 44
-
ok thanks but this is to high level can you please direct me to some tutorials on the subject – user63898 Jan 21 '11 at 14:25
I know that this question is over a year old, but I thought I'd post some code to setup multiple sessions.
QWebView webView = new QWebView();
QNetworkCookieJar cookieJar = new QNetworkCookieJar();
QNetworkAccessManager nam = new QNetworkAccessManager();
nam.setCookieJar(cookieJar);
webView.page()->setNetworkAccessManager(nam);
Using this code, you can create multiple sessions and even enclose this code in its own class and just instantiate an instance of the class to be able to have multiple self contained web browser sessions within your application.

- 9,634
- 10
- 46
- 85