Qt 6.11 is out! See what's new in the release
blog
Read data from GUI in thread
General and Desktop
4
Posts
2
Posters
1.4k
Views
1
Watching
-
Hello!
I have vectors and i need to fill it depending on user input.
Vectors are large so i want to split computation in some threads, so i need to read data from GUI in those threads and return vector when task will be done.How i can do it?
Thank you in advance! -
Have you considered signals and slots? If your thread is running an event loop (exec()) you can connect a signal from the main GUI thread to a slot on the processing thread, and emit a signal from that thread when task is done.
-
You could emit a signal from the worker thread, handle it in the slot in the main UI thread, get your input data from there, and then emit a signal to be handled in the worker thread and continue processing there.