Reputation: 35
I am using a third party library from which i want to give a callback to UI( written in qt) upon some events. I am registring the call back with the function pointer of the UI but when i get the call back i get following error "QObject::startTimer: QTimer can only be used with threads started with QThread" and "QPixmap: It is not safe to use pixmaps outside the GUI thread" and segmentation fault.
I searched and found i cant call the UI functions directly as it is called in a different thread
I wanted to know how can i register the call back function to update the UI.
Upvotes: 1
Views: 1882
Reputation: 52317
The solution is threefold:
Only if you want to also receive signals inside your worker thread, e.g. feedback from user input (like "cancel" button), you need a QT event loop in your worker thread, too. Your QTimer won#t work if it is to trigger a slot in the worker thread w/o event loop.
Read http://doc.trolltech.com/4.5/threads.html
Upvotes: 1
Reputation: 76519
Well, it sounds like you need two things:
I think this would solve the interop problems.
Upvotes: 0