On 12/15/15 8:15 AM, Paul Offord wrote:
> When I run the code the extra thread starts OK and it starts to cycle
> around the loop with the 3 second sleep. However, the connected slot
> function Syncro::jumpToFrame(int new_frame) does not get called. If I
> change the connect from QueuedConnection to DirectConnection the slot
> function gets called but, as expected, in the context of my serviceThread.
> I need the slot function to run on the main thread.
>
> I guess it is because my jumpToFrame slot function is not on the main
> thread event loop, but I don’t understand how to get it on the loop.
Can you try adding a constructor to Syncro, and add either
moveToThread(QApplication::instance()->thread());
or
setParent(QApplication::instance());
to it? I'm not sure if QObjects have a valid thread affinity by default.