title: on calling close() the ui does not close
body: <p>In Qt I have a 2 forms say FirstUI and SecondUI. The main opens the FirstUI. Here I check if the databases needed for the application are present and if not present creates a new one. It also checks if there are any wifi network details stored in the database. If there are details  of the last connected wifi, then the application scans for available networks and connects to the wifi network using the details from the database. </p>
  
  <p>Now if there is no wifi detail in the database or if the network listed in the database is not present or if the application was unable to connect to the wifi network it will emit a signal WifiNotConnected();</p>
  
  <p>I have connected the signal to a slot that opens the SecondUI. </p>
  
  <pre><code>connect(this,SIGNAL(WifiNotConnected()),this,SLOT(OpenSecondUI()));
  .....
  
  void FirstUI::OpenSecondUI()
  {
     SecondUI *sec = new SecondUI();
     this-&gt;close();
     sec-&gt;show();
  }
  </code></pre>
  
  <p>The SecondUI opens, but this does not close the FirstUI. </p>
  
  <p>EDIT: If the wifi details are present, I have a class (WifiBoot) that inherits QObject and does the connection tasks for me. Since I want the GIF file to be played in the GUI and the connection to occur same time I have instantiated the class (WifiBoot) that does the wifi connection and moved it to another thread. After the wifi is connected I emit the finished signal which is connected to the slot to open the SecondUI</p>
  
  <pre><code>connect(worker,SIGNAL(finished()),this,SLOT(FinishedConnection()));
  
  void FirstUI::FinishedConnection()
  {
     OpenSecondUI();
  }
  </code></pre>
  
  <p>Here it closes the FirstUI and opens the SecondUI. But in the first case it does not. Why is this happening? Is there a better way to go about it?
  Any help is appreciated</p>