title: Signal is not calling slot from another thread
body: <p>I am trying to update gui from another thread by using this: <a href="https://stackoverflow.com/a/14546167/2236297">https://stackoverflow.com/a/14546167/2236297</a></p>
  
  <p>This is my workerthread:</p>
  
  <pre><code>class WorkerThread : public QThread {
      void run() {
          while(1) {
  
              //QTcpSocket messenger;
              //messenger.connectToHost("192.168.1.20", 61000);
              //if(!messenger.waitForConnected(3000))
              //{
                  emit progressChanged("111");
              //}
          }
      }
      // Define signal:
      signals:
      void progressChanged(QString q)
      {
  
      }
  };
  </code></pre>
  
  <p>Only difference is I declared this class as a inner class and defined progressChanged. In his example signal was just declared, not defined.</p>
  
  <p>My onProgressChanged:</p>
  
  <pre><code>void ApplicationController::onProgressChanged(QString info) 
  {
      // Processing code
      ui.label_2-&gt;setText("Latest info: " + info);
  }
  </code></pre>
  
  <p>This is how I start thread in my constructor:</p>
  
  <pre><code>ApplicationController::ApplicationController(QWidget *parent, Qt::WFlags flags)
      : QMainWindow(parent, flags)
  {
      ui.setupUi(this);
  
       WorkerThread *workerThread = new WorkerThread;
      // Connect our signal and slot
      connect(workerThread, SIGNAL(progressChanged(QString)),
                            SLOT(onProgressChanged(QString)));
      // Setup callback for cleanup when it finishes
       connect(workerThread, SIGNAL(finished()),
               workerThread, SLOT(deleteLater()));
      // Run, Forest, run!
      workerThread-&gt;start(); // This invokes WorkerThread::run in a new thread
  
  }
  </code></pre>
  
  <p>Question is: why my slot isn't called. What should I change?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Changed workerthread.</p>
  
  <p>.h file</p>
  
  <pre><code>class WorkerThread : public QThread
      {
          Q_OBJECT
  
      public:
          WorkerThread();
          ~WorkerThread();
          void run();
  
      private:
  
      signals:
          void progressChanged(QString info);
      };
  </code></pre>
  
  <p>.cpp file</p>
  
  <pre><code>WorkerThread::WorkerThread() { }
  WorkerThread::~WorkerThread() { }
  
  void WorkerThread::run()
  {
      while(1) {
          QTcpSocket messenger;
          messenger.connectToHost("192.168.1.20", 61000);
          if(!messenger.waitForConnected(3000))
          {
              emit progressChanged((QString("%1").arg(messenger.error())));
          }
      }
  }
  </code></pre>
  
  <p>In debug, emit works. But slot is not called in main function.</p>