Qt Slots Not WorkWork

Qt Connect Slot

Qt is well known for its signals and slots mechanism. But how does it work? In this blog post, we will explore the internals of QObject and QMetaObject and discover how signals and slot work under the hood. In this blog article, I show portions of Qt5 code, sometimes edited for formatting and brevity.

I know this should pretty much work 'out of the box' if you pay attention to some details, which I tried to - but I must have missed something.

Virtual
  1. Thus, a developer who wishes to invoke slots in the new thread must use the worker-object approach; new slots should not be implemented directly into a subclassed QThread. Unlike queued slots or invoked methods, methods called directly on the QThread object will execute in the thread that calls the method.
  2. Deposit and play through £25 Qt Signal Slot Does Not Work to get 25 wager-free spins. Deposit and play through £100 to get 100 wager-free spins. Deposit and play through £200 to get 200 wager-free spins. 18+ New eligible UK players only. Offer must be claimed within 14 days of registration. All wager-free spins are available on Starburst.
  3. In Qt Designer's signals and slots editing mode, you can connect objects in a form together using Qt's signals and slots mechanism.Both widgets and layouts can be connected via an intuitive connection interface, using the menu of compatible signals and slots provided by Qt Designer.

I have a worker thread which starts another worker thread let's call it subworker. The worker and the subworker need to communicate via signals and slots. I make all the connections from the worker thread, and all the connect() statements return true when running (also, there's no warnings reported in the debug output).

The relevant worker thread code looks like this:
@
//! The subworker will live in its own thread
subWorkerThread = new QThread(this);
subWorkerObj.moveToThread(subWorkerThread);

Qt Slots Not Work

//! Let it live!
subWorkerThread->start();

Qt Slots Keyword

Not

Qt Public Slots

bool ok = connect(this, SIGNAL(work(QString)), &subWorkerObj, SLOT(beginWork(QString)));
ok = connect(&subWorkerObj, SIGNAL(signalFromSubWorker()), this, SLOT(handleSignalFromSubWorker()));
@

Then inside the subWorkerObj::beginWork:
@
emit signalFromSubWorker();
@

Qt Signal Slot Not Working

My debugging shows me that the beginWork() slot is correctly hit, but after the signal from SubWorker is emitted, I'm not hitting the breakpoint inside the handleSignalFromSubWorker() slot.

Both classes subclass QObject (or a QObject subclass), both have the Q_OBJECT macro, and I made the slot in the worker public just in case.

I'd appreciate any help, even about how to better debug it.