Page 1 of 1

How to use QThread in ECMAScript code?

Posted: Tue Aug 14, 2018 1:25 pm
by fang_h_y
Hello.

I want to set a new thread to compute. Because compute costs a lot of time so I want to set a new thread. But when I use
var thread = new QThread();
The console tell me that "Can't find variable: QThread".
How should I do to realize it?

Thank you very much.
fang_h_y

Re: How to use QThread in ECMAScript code?

Posted: Thu Aug 23, 2018 3:36 pm
by andrew
Some of the Qt API (including QThread) is not available for scripts. This likely means it would cause problems.

Re: How to use QThread in ECMAScript code?

Posted: Sat Sep 29, 2018 3:01 am
by fang_h_y
Hello,andrew

Is there anyway way to solve this problem? I want to do some function that spend a lot of time in other thread. If realize the function in GUI thread, it will block the GUI thread.

Look forward your reply
fang_h_y

Re: How to use QThread in ECMAScript code?

Posted: Fri Oct 05, 2018 3:12 pm
by andrew
You could call QCoreApplication.processEvents(); in your loop to keep the GUI responsive.