Reacting on Signal on qml side
Hello friends,
just a questions. is it normal that when I generate signals like this
Code:
//c++ side
for(int i = 0; i < 1000000; ++i){
emit testSignal(i);
}
//on qml side
....
onTestSignal:{
console.log(count)// or any other binding
.....
}
that its blocks my qml gui? Its realy not reactive!
How can I achieve nonblocking reaction to the signals?
Re: Reacting on Signal on qml side
When you run a loop on the main thread, the main thread is busy with that loop.
It if is busy with that loop, it can't do any event processing.
There are a number of options on how to change that:
1) Restructure the code to use a timer based iteration instead of a tight loop
2) Run the loop in a secondary thread
3) Call QCoreApplication::processEvents() in each loop iteration to do event processing before continuing with the loop.
Cheers,
_