I solved my issue by moving the
mySubQThread
run()
into themyQThread
run()
That said, I still
The problem is because you have overridden QThread.run()
. The run
method by default contains an implementation that handles signal processing.
If you want to use signals/slots correctly you should subclass QObject
, put your code in a method in there, and use moveToThread()
to move the QObject
to a base instance of QThread
that you instantiate. You can then run your code by connecting your method to the QThread.started
signal and then calling thread.start()
You can then repeat the creation of the child thread in a similar way, by putting that code in the method of the QObject
previously created and launched in the thread. Signals and slots you connect there will be made between the thread and it's child thread correctly.
This is a good example of proper communication between the main thread and a QThread
, but you could easily extend it to between QThreads
. Just modify the MyWorker.firstWork()
method to launch a new QThread
like is already done in the setupThread
method.