title: Qt dynamically add tasks to a threadpool queue with pause/stop functionality
body: <p><strong>Context</strong></p>
  <p>I have a long running process returning a result. This result <em>may</em> need further processing. There can also be multiple results ready simultaneously. Each one of these results that needs further processing may take a while too.</p>
  <p>I need to take each one of those results, throw each into a queue of sorts and process each one, with the ability to start/stop this process.</p>
  <p><strong>Problem:</strong></p>
  <p>At the moment, I am limited to using a <a href="https://doc.qt.io/qt-5/qfuture.html" rel="nofollow noreferrer">QFuture</a> with a <a href="https://doc.qt.io/qt-5/qfuturewatcher.html" rel="nofollow noreferrer">QFutureWatcher</a> and using either a <a href="https://doc.qt.io/qt-5/qtconcurrent.html#mapped" rel="nofollow noreferrer">QtConcurrent::mapped()</a> or <a href="https://doc.qt.io/qt-5/qtconcurrent.html#run" rel="nofollow noreferrer">QtConcurrent::run()</a> function (the latter which doesn't support direct pause/stop functionality, <a href="https://doc.qt.io/qt-5/qtconcurrent.html#run" rel="nofollow noreferrer">see note below</a>).</p>
  <p>The problem with the approech(es) mentioned above is it requires all results to be known up front, however to decrease the overall processing time, I would like to process each result as it comes in.</p>
  <p>How can I effectively process create a thread pool with a queue of tasks?</p>