title: QT C++ - Class problem wait until signal is processed and return data back
body: <p>I've this code here in a program I'm making but I've a problem, How can I keep the program waiting for data on http2 before returning to the tcpserver class? And how can I get the data in the tcpserver class?</p>
  
  <p>This is like a checkpoint were I need to get the data from the server and then keep running the tcpserver and use that data there.</p>
  
  <p><strong>tcpserver.cpp</strong></p>
  
  <pre><code>#include "tcpserver.h"
  #include "protocol.h"
  #include "http2.h"
  
  QTextStream in(stdin);
  
  tcpserver::tcpserver(QObject *parent) :
      QObject(parent)
  {
      server = new QTcpServer(this);
  
      [ ... Other Server Stuff ... ]
  
      http2 *h = new http2(this); 
  
  }
  </code></pre>
  
  <p>I've tried this with no luck:</p>
  
  <p><strong>http2.cpp</strong></p>
  
  <pre><code>#include "http2.h"
  bool httpdonne = false;
  QByteArray finaldata;
  
  http2::http2(QObject *parent, QByteArray url, QByteArray data) :
      QObject(parent)
  {
      url.append(data);
  
      m_manager = new QNetworkAccessManager(this);
      connect(m_manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(httpdown(QNetworkReply*)));
  
      QNetworkRequest request;
      request.setUrl(QUrl(url));
      request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
  
      m_manager-&gt;get(request);
  
      while ( httpdonne == false ) {
  
      }
  
      finaldata.append("HTTP: ");
      qDebug() &lt;&lt; finaldata;
  
  }
  
  QByteArray http2::httpdown(QNetworkReply* result)
  {
      QByteArray data = result-&gt;readAll();
      finaldata = data;
      httpdonne = true;
      return data;
  }
  </code></pre>
  
  <p>Thanks a lot! ;)</p>