I am looking for a way to get all threads created by one of my class to let me use them (threads are created dynamically depending on the user and I can't predict how many will be working while my application is working). Is there a good way to get all thread objects pointers and put them in one place so I can manipulate those threads?
As a first, the best solution would definitely to keep track of the QThread
's created. Even if they are created "on-the-fly", you should be able to store pointer to them, even globally.
Assuming they are at least parented to the same QObject
, you could use:
QList<QThread*> QObject::findChildren <QThread*> () const
To find all child QThread
's
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With