title: pyqt5 How to update popup progress bar by using moveToThread?
body: <p>I want to update the popup progress bar.</p>
  <p>I refer to <a href="https://stackoverflow.com/questions/39592180/how-to-properly-quit-a-qthread-in-pyqt5-when-using-movetothread">How to properly quit a QThread in PyQt5 when using moveToThread</a>, <a href="https://stackoverflow.com/questions/6783194/background-thread-with-qthread-in-pyqt/33453124#33453124">Background thread with QThread in PyQt</a></p>
  <p>In MainWindow, When I clicked a button, the program does some work and SubWindow(progressbar) will show. And I think, thread starts, the thread sends a signal to SubWindow(progressbar). But the program is dead right after SubWindow show. I use Jupiter notebook.</p>
  <p>Here is my code.</p>
  <pre class="lang-py prettyprint-override"><code>class MainWindow(QMainWindow, FORM):
      def __init__(self):
          super().__init__()
          self.setupUi(self)
          self.button_num.clicked.connect(self.save_num)
  
      def save_num(self):
          s = SubWindow(5)
          save_thread = QThread()
          save_obj = save_object()
          save_obj.moveToThread(save_thread)
          save_obj.progress_signal.connect(s.progress_value)
          save_obj.finished.connect(save_thread.quit)
          save_thread.started.connect(save_obj.save_num)
          save_thread.start()
  
  
  class SubWindow(QWidget):
      
      def __init__(self, val):
          super().__init__()
          self.progress = QProgressBar()
          self.progress.setMinimum(0)
          self.progress.setMaximum(val)
          self.layout = QVBoxLayout()
          self.layout.addWidget(self.progress)
          self.setLayout(self.layout)
          self.show()
          
      @pyqtSlot(int)
      def progress_value(self, val):
          self.progress.setValue(val)
  
  
  class save_object(QObject):
      
      progress_signal = pyqtSignal(int)
      finished = pyqtSignal()
      
      def save_num(self):
          count = 0
          while count &lt; 5:
              time.sleep(1)
              print(count)
              count += 1
              self.progress_signal.emit(count)
          self.finished.emit()
  </code></pre>
  <ol>
  <li>Is it the right way?</li>
  <li>What is the problem?</li>
  </ol>