title: Blocked waiting for a asynchronous Qt signal
body: <p>I know, there are some similar questions to the following out there, but I couldn't find a concrete answer that helps me. So here's my problem:</p>
  
  <p>I work on an application that does some gui-initialisations on start up. One of the things I have to do, is calling</p>
  
  <pre><code>NetworkConfigurationManager::updateConfigurations ()
  </code></pre>
  
  <p>This is a asynchronous call, which emits the <code>updateCompleted()</code> signal, when it is finished. The problem is, that all my other gui-initialisations have to wait until the <code>updateConfigurations()</code> is finished. </p>
  
  <p>So what I could do would be something like this:</p>
  
  <pre><code>MyApp::MyApp(QWidget *parent) : ....
  {
     doSomeInits();
     //Now connect the signal we have to wait for
     connect(configManager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationUpdated()));
     configManager-&gt;updateConfigurations(); //call the async function
  }
  
  void MyApp::networkConfigurationUpdated()
  {
     doSomething();
     doRemainingInitsThatHadToWaitForConfigMgr();
  }
  </code></pre>
  
  <p>To split up the initialisation doesn't seem a good way to me. I think it makes the code much harder to read - inits should remain together. The other thing is: Because <code>updateConfiguration()</code> is <strong>asynchronous</strong>, the user will be able to use the GUI, which doesn't give him any information yet, cause we are waiting for <code>updateCompleted()</code>.</p>
  
  <p><em>So is there a way to wait for the <code>updateCompleted()</code> signal, before the application continues?</em></p>
  
  <p>like:</p>
  
  <pre><code>MyApp::MyApp(QWidget *parent) : ....
  {
     doSomeInits();
     //Now connect the signal we have to wait for
     connect(configManager, SIGNAL(updateCompleted()), this, SLOT(doSomething()));
     ???? //wait until doSomething() is done.
     doRemainingInitsThatHadToWaitForConfigMgr();
  }
  </code></pre>
  
  <p>In some APIs there are blocking alternatives to asynchronous functions, but not in this case.</p>
  
  <p>I appreciate any help. Thanks!</p>