multithreadingqtqobject

Does moveToThread() rewrite direct connections to queued connections?


When moving an object from one thread to another, does moveToThread() automatically rewrite existing direct connections to queued connections?

Or in other words: Does it matter if automatic connections are established before or after a call to moveToThread()?

Unfortunately neither the documentation nor the WWW had an answer on this question.


Solution

  • According to Qt documentation: If the receiver lives in the thread that emits the signal, Qt::DirectConnection is used. Otherwise, Qt::QueuedConnection is used. The connection type is determined when the signal is emitted.