title: Using the closeEvent in a qt application does not close it
body: <p>I am learning qt, and experimenting with examples from a textbook.</p>
  
  <p>The original textbook code has the following, set up to save and close on the x button:</p>
  
  <pre><code>void MainWindow::closeEvent(QCloseEvent *event)
  {
      if (okToContinue()) {
          writeSettings();
          event-&gt;accept();
      } else {
          event-&gt;ignore();
      }
  }
  </code></pre>
  
  <p>i experimented with a simple exit in its menu - and it works:</p>
  
  <pre><code>void MainWindow::close()
  {
      if (okToContinue()) {
          QApplication::quit();
      }
  }
  </code></pre>
  
  <p>But I want to take advantage of the already written closeEvent, so i replaced the code above with</p>
  
  <pre><code>void MainWindow::close()
  {
      QCloseEvent *event = new QCloseEvent();
      closeEvent(event);
  }
  </code></pre>
  
  <p>I get the checking for changes and saving app, implemented through the okToContinue function. But the application does not close. </p>
  
  <p>i tried to follow through debugging and.. with my small understanding, it seems that there is a close signal being sent...</p>
  
  <p>I don't have a good understanding of this, can somebody please help me figure out what am i doing wrong and how to fix it ? </p>
  
  <p>(the sample code is from C++ GUI Programming with Qt 4, chapter 3)</p>