title: QObject::connect in QRunnable - console
body: <p>I create simple multi threading server:</p>
  
  <ul>
  <li>Create server</li>
  <li>If new connection create new QThreadpool - QRunnable</li>
  <li>In runnable send message to client and wait request</li>
  <li>If client was been disconnected runnable write qDebug and runnable quit.</li>
  </ul>
  
  <p>server.h</p>
  
  <pre><code>class Server : public QTcpServer
  {
  Q_OBJECT
  public:
  explicit Server(QObject *parent = 0);
  void StartServer();
  
  protected:
  void incomingConnection(int handle);
  
  private:
  QThreadPool *pool;
  };
  </code></pre>
  
  <p>server.cpp:</p>
  
  <pre><code>#include "server.h"
  
  Server::Server(QObject *parent) :
  QTcpServer(parent)
  {
  pool = new QThreadPool(this);
  pool-&gt;setMaxThreadCount(10);
  }
  
  void Server::StartServer()
  {
  this-&gt;listen(QHostAddress(dts.ipAddress),80));
  }
  
  void Server::incomingConnection(int handle)
  {
  Runnable *task = new Runnable();
  task-&gt;setAutoDelete(true);
  
  task-&gt;SocketDescriptor = handle;
  pool-&gt;start(task);
  }
  </code></pre>
  
  <p>runnable.h</p>
  
  <pre><code>class Runnable : public QRunnable
  {
  public:
  Runnable();
  int SocketDescriptor;
  
  protected:
  void run();
  
  public slots:
  void disconnectCln();
  };
  </code></pre>
  
  <p>runnable.cpp</p>
  
  <pre><code>#include "runnable.h"
  
  Runnable::Runnable()
  {
  
  }
  
  void Runnable::run()
  {
  if(!SocketDescriptor) return;
  
  QTcpSocket *newSocketCon = new QTcpSocket();
  newSocketCon-&gt;setSocketDescriptor(SocketDescriptor);
  </code></pre>
  
  <p><strong>!!! How make it???!!!  QObgect::connect(newSocketCon, SIGNAL(disconnected()), this, SLOTS(disconnectCln()));</strong></p>
  
  <pre><code>newSocketCon-&gt;write(mes.toUtf8().data());
  newSocketCon-&gt;flush();
  newSocketCon-&gt;waitForBytesWritten();
  }
  
  void Runnable::disconnectCln()
  {
  qDebug() &lt;&lt; "Client was disconnect";
  }
  </code></pre>