You can use
QThreadPool to execute your code in a separate thread.
QThreadPool deletes the
QRunnable automatically if
true (the default). Use
setAutoDelete() to change the auto-deletion flag.
QThreadPool supports executing the same
QRunnable more than once by calling
tryStart (this) from within the
run() function. If
autoDelete is enabled the
QRunnable will be deleted when the last thread exits the run function. Calling
start() multiple times with the same
autoDelete is enabled creates a race condition and is not recommended.
- class PySide6.QtCore.QRunnable#
QRunnable . Auto-deletion is enabled by default.
- Return type
true is auto-deletion is enabled; false otherwise.
Implement this pure virtual function in your subclass.
autoDelete – bool
Enables auto-deletion if
autoDelete is true; otherwise auto-deletion is disabled.