What design fits my situation?
I have a webview widget and I want to perform actions in a linear style to a web page. The problem is that I can't return to the code after I finish loading a url in the view, so how would I go back and finish executing everything? (C++)
Pseudo-code:
Code:
perform some tasks
webview loads a url
do stuff to page
webview loads another url
do stuff again
The loading happens concurrently, so for example the page will start loading and then it will already try to manipulate it and then load another page.
Re: What design fits my situation?
Quote:
Originally Posted by
caelestis
I
Code:
perform some tasks
webview loads a url
do stuff to page
webview loads another url
do stuff again
Start an event loop.
Send a signal to slot firstStep.
In slot firstStep:
Perform some tasks.
Connect signal QWebView::loadFinished to slot secondStep.
Call QWebView::load.
return;
In slot secondStep:
Do stuff to page.
Connect signal QWebView::loadFinished to slot thirdStep.
Call QWebView::load.
return;
In slot thirdStep:
Do stuff again.
return.