PDA

View Full Version : Handling multiple web pages in Qt WebKit Browser



dpen41
24th June 2011, 11:57
Hi All,

I am designing Qt WebKit based custom browser. The client's requirement is that at any point of time there should be 4 web pages should be active in memory. These web pages will actually work as front end for users.

So if user want to switch from one appliation (i.e. web page) to another it should be instantly.

My understanding is that browser will handle only one web page at a time. If another page needs to be loaded then it will discard current web page. So in my application I want to keep current web page as it is but new web page should be displayed to user.

Let me know how these can be done.

Regards,
Dipen Patel

Santosh Reddy
25th June 2011, 10:52
can't you stack browsers and show only the active one, (4 instance of browsers)

dpen41
27th June 2011, 06:11
Hi Santosh,

That could be a possible solution but this is for power and memory conservative embedded device. Running 4 browser instances is not a good idea.

I am thinking of something like to have 4 instances of QWebPage class in side my Browser application and manage them. So if user wants to switch an application (web page) display particular instance of QWebPage.

Let me know if that could be possible to implement.

Regards,
Dipen Patel

Santosh Reddy
27th June 2011, 06:24
That could be a possible solution but this is for power and memory conservative embedded device. Running 4 browser instances is not a good idea.
I meant to have 4 instance of QWebPage


I am thinking of something like to have 4 instances of QWebPage class in side my Browser application and manage them. So if user wants to switch an application (web page) display particular instance of QWebPage.

Let me know if that could be possible to implement.
You already have a solution, just manage 4 pages. You already know how to implement 1 page, just extent to 4 pages, what is the problem in it, I could not understand.

dpen41
28th June 2011, 12:29
Hi Santosh,

I did following to create and initialize 4 QWebPage objects with 4 different URLs. Each url* is initialized with different URL string.

gWebView->setPage(qPage1);
gWebView->load(url1);
qPage1 = gWebView->page();

gWebView->setPage(qPage2);
gWebView->load(url2);
qPage2 = gWebView->page();

gWebView->setPage(qPage3);
gWebView->load(url3);
qPage3 = gWebView->page();

gWebView->setPage(qPage4);
gWebView->load(url4);
qPage4 = gWebView->page();

So on start up url4 is loaded. But later when I type below to load qPage2 it does nothing.



gWebView->setPage(qPage2);


Let me know is it right way to initialize qPage objects and assign them to gWebView object dynamically at run time?

Regards,
Dipen Patel

dpen41
2nd July 2011, 06:09
Hi Santosh,

Let me know if you have any idea what's going wrong with my code.

Regards,
Dipen Patel

rbp
7th February 2012, 21:15
Not sure what the problem is, but perhaps this threading example using pyqt (http://sitescraper.net/blog/Threading-with-webkit/) will help.