Thread and Event Handler
-
I am building a data collection system where I am using Qt to display data while a thread is collecting the data. The question I have is with the event loop. I need to be able to collect new data from the system and then signal the main app that data has arrived. I am not sure how to structure this with the event handler running. Is it okay to manually call the event handler after I get new data? or is there another method that I should look into?
-
Have you already taken a look on "signals and slots":http://doc.qt.digia.com/qt/signalsandslots.html?
-
I plan on using signals and slots to pass data/commands between the main GUI and the thread running the data collection. That is the issue I am having. In order to signals I have to use the QT event handler. I need a way for my data collection function to run continously and signal data changes when needed.
-
Be aware that you do not need an event loop to emit signals, just to receive.
And, as always, make sure you've read "Threads, Events and QObjects":http://qt-project.org/wiki/Threads_Events_QObjects.
-
Use QDbus inter-process communication (IPC) mechanism