View Full Version : How to use QWebView asynchronous call js function?

23rd February 2018, 08:53
hi ,all.

i use evaluateJavaScript , but i find that is so slow.

i hope like QWebEngineView runJavaScript , asynchronous call.

How do you give me a hint?


25th February 2018, 07:39
Bear in mind that QWebEngineView also has a single thread for the JavaScript world so the amount of time it takes to execute your script is similar, only that it doesn't block the UI. If you are only about asynchronousness, you can spawn a Worker in JS and make it execute your code.

26th February 2018, 03:04
Thank you for your help.

i use QWebView , when call evaluateJavaScript , UI is blocked.

how to solve this problem.

Same problem with me. This issue appears to be unresolved. https://forum.qt.io/topic/12974/evaluatejavascript-only-works-in-the-main-thread/3

my code:

QTime time;
QString method = QString(QString("add_html('%1')").arg(qsContent));
qDebug()<<"time is : "<<time.elapsed();//1205ms