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

Tobias Rzepka tobias.rzepka at gmail.com
Sun Jul 15 16:57:29 BST 2018


Have a look into the Eric debugger. I've already implemented a solution to intercept the QThread creation and to inject code to trace the excecution.
Tobias

Gesendet von meinem BlackBerry 10-Smartphone.
  Originalnachricht  
Von: David Boddie
Gesendet: Sonntag, 15. Juli 2018 17:54
An: Ned Batchelder
Cc: pyqt at riverbankcomputing.com
Betreff: Re: [PyQt] Any way to run code before each QThread?

On Sunday 15. July 2018 11.24.42 Ned Batchelder wrote:
> On 7/15/18 10:55 AM, Florian Bruhin wrote:

> > That's only for a given QThread instance though - it'd probably work if
> > you could somehow find out about all QThread instances created in a
> > project, but I can't think of a good way to do that.

I missed that detail, though I should have suspected my solution was a bit
too easy.

> I've only poked around for ten minutes, but that's what I'm seeing also:
> I could get a signal from a specific thread, but only if I were alerted
> to its creation and could connect the signal.
> 
> Anyone have any other hacky^H^H^H^H^Hcreative ideas for how to
> accomplish this? :)

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.

David
_______________________________________________
PyQt mailing list PyQt at riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


More information about the PyQt mailing list