title: Qt : Best approach to wait for a signal from a function
body: <p>I currently have something like this</p>
  
  <pre><code>void foo::replyFinished(QNetworkReply* rply)
  {
       .....
       .....
  }
  
  void foo::ReceiveReport()
  {
    //Communicate with http
     QUrl url(url_complete.c_str());
     QNetworkRequest request;
     request.setUrl(url);
     currentReply = networkManager-&gt;get(request);
  }
  
  
  void foo::mymethodA()  //Start from here
  {
     ReceiveReport();
     -----------------&gt; Wait();
     MoreStuff();
  }
  </code></pre>
  
  <p>Now what happens is that I call mymethodA. This method called ReceiveReport.
  The receive report has a signal that connects to replyFinished(). Now what I want is to wait until I have received a reply from network and this happens when replyFinished is called.Currently the problem is that the method MoreStuff() is called before the method replyFinished() is triggered. My question is how can I make it wait till i received a reply ? All of these are running in the same thread</p>