code: def createThread(parent, worker, deleteWorkerLater=False):
      
      thread = QtCore.QThread(parent)
      thread.started.connect(worker.doWork)
      worker.finished.connect(thread.quit)
      if deleteWorkerLater:
          thread.finished.connect(worker.deleteLater)
  
      worker.moveToThread(thread)
      worker.setParent(parent)
      return thread
docs: Create a new thread for given worker.
  
      Args:
          parent (QObject): parent of thread and worker.
          worker (ProgressWorker): worker to use in thread.
          deleteWorkerLater (bool, optional): delete the worker if thread finishes.
  
      Returns:
          QThread