views:

244

answers:

1

I'm calling QWebFrame::evaluateJavaScript in one place in my code and it has no effect. However, if I replace this call with the setTimer(0) call and will call the original function when this timer times out it works. How do I know if it works or not? The JavaScript code which is evaluated in my case calls one JavaScript function which in turn makes AJAX call. This AJAX call in turn makes QNetworkAccessManager used by QWebFrame create and send a QNetworkRequest. There is no request being created when I call QWebFrame::evalutateJavaScript directly from my code, however. That's what I mean when I say it does not work in the first scenario.

It looks like something is preventing QtWebKit and//or QNetworkAccessManager from carrying out their job after evaluateJavaScript is called. I suspect it has something to do with events and the main (gui) event loop. Any ideas?

+1  A: 

Given your comments about using setTimer(), calling qApp->processEvents() at the right point might solve the problem.

Could you provide some code? I'm not sure what you mean by this:

This AJAX call in turn makes QNetworkAccessManager used by QWebFrame create and send a QNetworkRequest.

Sam Dutton