dimanche 27 octobre 2019

Exchanging different kinds of data between threads in Qt

That's kind of design question. Say, I have a worker thread and a GUI thread. The worker thread does some work and the GUI must show the information about current status of this work (for example, worker can process some files and the GUI must show the number of processed files, having separate counters for different types of files).

In Qt the information exchange between thread should be done via signals-slots mechanism. But if I have a lot of different kinds of information to pass from thread to thread, should I create different signals for each type of information (for example, for each type of file), or it would be better to create one signal (for example, informationUpdated(InfoContainer); with a special struct (InfoContainer), which will store the data I want to pass?

Aucun commentaire:

Enregistrer un commentaire