c++ - When to use QThread::exec() -
i've checked satisfying explanation not find. docs mention in order use signals/slots between threads, need use event loops , start them calling exec.
however can see w/o using exec(), can still send signals , handle them across threads.
what's exact use of it?
use qthread::exec()
when want run event loop qt provides in qthread class. if don't call exec(), need create own event loop processes qt events (that is, if want signals / slots work). more work it's worth, unless have specific needs.
you can still send signals / slots? guess you're not running on different thread. common issue when using qthread. put breakpoint inside code think running on different thread , have @ stack trace - may in shock!
Comments
Post a Comment