title: Simple Qt threading mechanism with progress?
body: <p>I want to look for files with given extensions recursively from a given root directory and to display the number of files currently found in my GUI.
  Since this kind of processing may be long, the GUI may be blocked.
  I could just wait for the end of the processing and get the file count, but I am learning Qt (PyQt), so I see this as a training.</p>
  
  <p>So I have read Qt doc:
  <a href="https://qt-project.org/doc/qt-5-snapshot/thread-basics.html#when-to-use-alternatives-to-threads" rel="nofollow">When to Use Alternatives to Threads</a>, and I don't think it's for me.</p>
  
  <p>Then I read:
  <a href="https://qt-project.org/doc/qt-5-snapshot/threads-technologies.html#choosing-an-appropriate-approach" rel="nofollow">Choosing an Appropriate Approach</a>, and I think my solution is the first one:</p>
  
  <blockquote>
    <p>Run a new linear function within another thread, optionally with
    progress updates during the run</p>
  </blockquote>
  
  <p>But in this case you have 3 choices:</p>
  
  <blockquote>
    <p>Qt provides different solutions:</p>
    
    <ul>
    <li>Place the function in a reimplementation of QThread::run() and start the QThread. Emit signals to update progress. OR</li>
    <li>Place the function in a reimplementation of QRunnable::run() and add the QRunnable to a    QThreadPool. Write to a thread-safe variable
    to update progress. OR</li>
    <li>Run the function using QtConcurrent::run(). Write to a thread-safe variable to update progress.</li>
    </ul>
  </blockquote>
  
  <p>Could you tell me how to choose the best one?
  I have read some "solutions" but I'd like to understand why you should use one methodology instead of another one.</p>
  
  <p>And also since I am looking for files, I may have a directory in which many files would match the search criteria. So it would mean lots of interruptions. Is there something special to keep in mind regarding this?</p>
  
  <p>Thank you!</p>