i posted a question on a qt forum, but i am impatient, and thought perhaps some here might know the answer
update widget from separate thread - Qt Centre Forum
i posted a question on a qt forum, but i am impatient, and thought perhaps some here might know the answer
update widget from separate thread - Qt Centre Forum
> but i am impatient
How To Ask Questions The Smart Way
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Tried calling repaint() on the widget in question?
yes. it fails a thread-safety assertion when i try to call repaint(...) from my image acquisition thread.
it just doesn't do anything if i call update.
the solution i've come up with so far is to have paint event recurse by calling update at the end of the method, but that is a bit of a resource hog. if i am sampling at 1Hz, i am wastefully updating the same image many times.
You probably need to emit a signal from your worker thread to the main thread, the have the main thread update the widget. I don't know much about QT though, so it's just a guess.
bithub is right. The Qt way for cross-thread communication is to connect a signal on an object that belongs to the sender thread to a slot on an object that belongs to the receiver thread.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
got it. i was stupidly trying to emit a slot.