The callback system is performed using the
Notify class. Two classes,
NotifyQt derive from the same
NotifyBase pure virtual class.
The NotifyQt is responsible for sending messages to the interface and various windows open. This can be done in several ways, provided that the interface is correctly locked to avoid concurrent write access from different threads.
csoler: Up to me the best way to do this is to use the signal system of Qt: For each functionality NotifyQt has a signal that is connected to a slot of the target window.
Indeed, Qt already has a queue system to handle events from threads, so all actions requested by a signal are handled properly even if they come from threads. That's what I've done for displayig hashing info: Thread 1:
NotifyBase::hashingInfo(std::string)is derived into
NotifyQt::hashingInfo(std::string)emits the signal
MainWindowreceives this signal on its slot
displayHasingInfo(QString)and performs the display.
- suppress the interface lock that is called sometimes in
NotifyQtand use Qt signals instead