Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Wait for execution
gRicky last edited by
I have a for loop in my GUI thread which sets some command but from one command to the next my loop should have to wait the answer from a serial device before going on. What is the right method to pause the for execution while the code is answering and receiving from the serial device?
My pseudo code is:
@ for i=0 to 1000
send command to the serial device wait for answer update tablewidget go to next@
Please reformat this pseudocode and wrap it in '@' tags.
It's generally considered better to use the event loop together with signals and slots, rather that waiting explicitly. But, if you insist, this piece of code should do the work:
if (isAnswer == true)