title: Create Thread in QDialog and emit signals to QDialog in Qt
body: <p>I created an application that has a mainwindow and from this window creates a QDialog. This QDialog should create a RenderThread that emits received images from the camera or in the example emits text. When i debug this it seems that the connection is never made as adding a breakpoint in the slot <code>CameraWindow::debugSomething</code> does not get caught. Whats wrong ?
  I followed this example: <a href="http://qt-project.org/doc/qt-4.8/threads-mandelbrot.html" rel="nofollow">http://qt-project.org/doc/qt-4.8/threads-mandelbrot.html</a> but it seems that i've done something wrong.</p>
  
  <pre><code>qtDEVC::qtDEVC(QWidget *parent, Qt::WFlags flags)
      : QMainWindow(parent, flags)
  {
      ui.setupUi(this);
      connect (ui.pushButton_startCam, SIGNAL( clicked() ),this,SLOT( startCam() ) );
  
      /**Threading*/
      CameraWindow camWindow = new CameraWindow(this);
  }
  
  
  int qtDEVC::startCam()
  {
      camWindow.show();
      camWindow.startCaptureThread();
  }
  </code></pre>
  
  <p>CameraWindow Class:</p>
  
  <pre><code> CameraWindow::CameraWindow(QWidget *parent)
          : QDialog(parent)
      {
      ui.setupUi(this);
  
      connect(&amp;thread, SIGNAL(sendText(std::string)),
          this, SLOT(debugSomething(std::string)));
  }
  
  void CameraWindow::debugSomething(std::string something){
      QString somethings(something.c_str());
  qDebug()&lt;&lt;somethings;
  }
  
  int CameraWindow::startCaptureThread(){
  
      RenderThread *thread = new RenderThread(this, guid, CLEYE_COLOR_RAW, CLEYE_VGA, 50); 
  
      thread-&gt;StartCapture(); //starts thread in low priority and sets _running to true
  }
  </code></pre>
  
  <p>CameraWindow header</p>
  
  <pre><code> class CameraWindow : public QDialog
   {
      Q_OBJECT
  
      public:
      CameraWindow(QWidget *parent = 0);
      ~CameraWindow();
      Ui::CameraWindow ui;
  
  public slots:
      int startCaptureThread();
      void debugSomething(QString);
  
  private:
      RenderThread thread;
  };
  </code></pre>
  
  <p>RenderThread Class</p>
  
  <pre><code> void RenderThread::run()
   {
  
      // image capturing loop
      while(_running)
      {
      qDebug()&lt;&lt;("render while()"); //is printed with qdebug correctly
      if (restart)
          break;
             if (abort)
                 return;
  
      qDebug("it");  //is also printed with qdebug correctly
  
      emit sendText(text);
  }
  </code></pre>
  
  <p>RenderThread header</p>
  
  <pre><code>class RenderThread : public QThread
  {
      Q_OBJECT
  
  public:
      RenderThread(QObject *parent, GUID cameraGUID, CLEyeCameraColorMode mode, CLEyeCameraResolution resolution, float fps);
      RenderThread();
      ~RenderThread();
  
      bool StartCapture();
  
  signals:
  
      void sendText(QString &amp;text);
  
  protected: 
      void run();
  
  private:
      QMutex mutex;
      QWaitCondition condition;
      //some more private variables for construction
  </code></pre>
  
  <p>};</p>
  
  <p>I think that this creation seems somehow wrong: <code>RenderThread *thread = new RenderThread(this);</code></p>