[PyQt] Any way to run code before each QThread?
David Boddie
david at boddie.org.uk
Sun Jul 15 16:54:07 BST 2018
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
More information about the PyQt
mailing list