Is QML compatible with multithreaded / asynchronous calls?

I am creating a UI in QML and am just now working on the UI logic, leaving the application logic for later. I'm a bit concerned about all the discussions I've looked at regarding multithreading and async versus synchronous code and sluggishness in UIs, and I want to make sure that when application logic is added later, QML isn't going to hold me back and slow me down by calling single-threaded asynchronous code somehow.

It may sound ridiculous, but I realize that I am new to non-web GUI. I come from the beautiful world of JS where all UI events are asynchronous and non-blocking.

Does anyone have any experience with this, either in python or C ++?

+3


source to share


1 answer


You can find an almost ready answer here: fooobar.com/questions/1153200 / ...

In a few words, you can use WorkerScript on the QML side , with all your functionality done in JavaScript / QML really asynchronous (but unfortunately I can't find a way to drop / stop this separate worker thread).



Another choice is to use QtQThread

. Read about multithreading in Qt here: Multithreading in Qt | QtDoc 5.3 , Threading Basics | QtDoc 5.3 and my favorite Qt book that can be very helpful in your case: Advanced Qt Programming: Building Great Software with C ++ and Qt 4 ). Then lay out your streams in QML. Read about opening C ++ classes to QML here: QML and C ++ Integration | QtQml 5.3 , Defining QML Types from C ++ | QtQml 5.3 .

+3


source







All Articles