title: Qt : restarting thread
body: <p>I'm working on a GUI with Qt, I have a problem with playing with threads . I create a small GUi with two button stream and stopstream. my Problem is that I can't restart stream after stoping it:
  below is a part of the code :</p>
  
  <pre><code>MainThread::MainThread(QWidget *parent):QWidget(parent){
  
      bstream = new QPushButton("&amp;stream");
      bstopstream = new QPushButton("STOP stream");
      bcapture = new QPushButton("capture a frame");
      Allbox = new QVBoxLayout(this);
      Allbox-&gt;addWidget(bstream);
      Allbox-&gt;addWidget(bcapture);
      Allbox-&gt;addWidget(bstopstream);
  
      connect(bstream,SIGNAL(clicked()),this, SLOT(startingstream()));
      connect(bcapture,SIGNAL(clicked()),this, SLOT(captureAFrame()));
      connect(bstopstream,SIGNAL(clicked()),this, SLOT(stopstreaming()));
  
      setLayout(Allbox);
  
  } 
  
  void MainThread::stopstreaming(){
      cv::destroyAllWindows();
  
      stream.terminate();
      stream.wait();
      stream.~Streaming();
  }
  
  void MainThread::startingstream(){
  
      if(stream.isRunning()) return;
      stream.start();
  
  }
  </code></pre>