migrating from Inherited QThread to Worker model

后端 未结 3 345
失恋的感觉
失恋的感觉 2021-01-23 00:36

So through a lot of help in my previous questions (Interrupting QThread sleep and PySide passing signals from QThread to a slot in another QThread) I decided to attempt to chang

3条回答
  •  深忆病人
    2021-01-23 00:59

    An alternative to the solution provided by @JonHarper is to replace your while loop with a QTimer. Because you have an event loop running in your worker process now, it can handle QTimer events correctly (as long as you construct the QTimer in the relevant thread).

    This way, control is returned to the event loop periodically so that other slots can be run when required.

提交回复
热议问题