title: Deleting a QWidget when closed
body: <p>I have my main application <code>QWindow</code> where, when I press a QPushButton a new child window (a <code>QWidget</code>) pops up.  There are two ways of exiting the <code>QWidget</code> window:</p>
  
  <ol>
  <li>Click the X in the top right hand corner, or</li>
  <li>Click on the 'Finished' <code>QPushButton</code> I have in the <code>QWidget</code> window.</li>
  </ol>
  
  <p>I would like to ensure that, when either method is used to exit the window, the <code>QWidget</code> is deleted.  I believe that I can ensure this in the second case by adding <code>self.deleteLater()</code> to the function called when the 'Finished <code>QPushButton</code> is clicked, but I am struggling to see how to do this in the first case.</p>