antiquebas.blogg.se

Qt update gui from worker thread
Qt update gui from worker thread





qt update gui from worker thread

Qt update gui from worker thread code#

That's why the proper way to do this is to notify main thread from worker, and the code in main thread will actually update text box, progress bar or something else.

Multiple threads within a process share the same data space with the main thread and can therefore share information or communicate with each other more easily than if they were separate. And to know whether a thread has finished, you can use an std::atomic flag that will be set when the computation is over (or use std::promise/future, which I prefer).

Important thing about Qt is that you must work with Qt GUI only from GUI thread, that is main thread. Running several threads is similar to running several different programs concurrently, but with the following benefits. I believe the issue is due to QT GUI updates being called from threads other than.







Qt update gui from worker thread