[PyQt] Any way to run code before each QThread?

David Boddie david at boddie.org.uk
Sun Jul 15 19:05:10 BST 2018

On Sunday 15. July 2018 17.54.07 David Boddie wrote:
> I think you could install an event filter on the application instance then
> handle ThreadChange events. However, this seems to be a recent addition to
> Qt. Perhaps in Qt 5.9 or so. I'll post an example shortly.

It looks like ThreadChange events report the _old_ thread an object was in
instead of the new one, so that approach would require some creative ways
to monitor the object in order to determine which thread it ended up in.

It could be made to work but it wouldn't look very nice.


More information about the PyQt mailing list