QThreads are ideal for putting a single long process into the background, especially when we want to communicate with that process using signals and slots. Sometimes, however, what we need to do is run a number of computationally intensive operations in parallel using as many threads as possible. This can be done with QThread, but a better alternative is found in QThreadPool and QRunner.
QRunner represents a single runnable task that we want our worker threads to perform. Unlike QThread, it is not derived from QObject and cannot use signals and slots. However, it is very efficient and is much simpler to use when you want many threads.
The QThreadPool object's job is to manage a queue of QRunner objects, spinning up new threads to execute the objects as compute resources become available.
To demonstrate how to work with this, let...