How to use QThread in ECMAScript code?

Discussion forum for contributors and developers who are using the QCAD ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Post Reply
fang_h_y
Newbie Member
Posts: 8
Joined: Sat Jul 14, 2018 4:15 am

How to use QThread in ECMAScript code?

Post by fang_h_y » Tue Aug 14, 2018 1:25 pm

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

User avatar
andrew
Site Admin
Posts: 5641
Joined: Fri Mar 30, 2007 6:07 am

Re: How to use QThread in ECMAScript code?

Post by andrew » Thu Aug 23, 2018 3:36 pm

Some of the Qt API (including QThread) is not available for scripts. This likely means it would cause problems.

fang_h_y
Newbie Member
Posts: 8
Joined: Sat Jul 14, 2018 4:15 am

Re: How to use QThread in ECMAScript code?

Post by fang_h_y » Sat Sep 29, 2018 3:01 am

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

User avatar
andrew
Site Admin
Posts: 5641
Joined: Fri Mar 30, 2007 6:07 am

Re: How to use QThread in ECMAScript code?

Post by andrew » Fri Oct 05, 2018 3:12 pm

You could call QCoreApplication.processEvents(); in your loop to keep the GUI responsive.

Post Reply

Return to “QCAD Developers and Contributors”