title: How to close a QWidget (subwindow of mdi area) by clicking on a pushbutton
body: <p>I have a mainwindow with a mdi area, that add a Qwidget as subwindow.</p>
  
  <p>When i call this QWidget and try to close it by clicking on close pushbutton, it only hides theQWidget, but if I click on QWidget's "X" button, it close correctly.</p>
  
  <p>I need to close the QWidget too, by clicking by the close pushbutton. Someone can help me with this?</p>
  
  <p>thank you very much!</p>
  
  <p>My code at the moment:</p>
  
  <pre><code># -*- coding: utf-8 -*-
  from PyQt4.QtCore import pyqtSignature
  from PyQt4.QtGui import QMainWindow,  QWidget
  from PyQt4 import QtGui,  QtCore
  import sys
  
  from ui.Ui_mainwindow import Ui_MainWindow
  from ui.Ui_widget import Ui_widget
  
  class MainWindow(QMainWindow, Ui_MainWindow):
      def __init__(self, parent=None):
          QMainWindow.__init__(self, parent)
          self.setupUi(self)
          self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) # does not make any difference, even if I comment this line
          self.setWindowState(QtCore.Qt.WindowMaximized)
          self.show()
  
      @pyqtSignature("")
      def on_action_widget_triggered(self):
          w = Widget()
          w.setAttribute(QtCore.Qt.WA_DeleteOnClose) # does not make any difference, even if I comment this line
          self.mdiArea.addSubWindow(w) 
          w.showMaximized()
  
  class Widget(QWidget, Ui_widget):
      def __init__(self, parent=None):
          QWidget.__init__(self, parent)
          self.setupUi(self)
  
      def keyPressEvent(self, event):
          if event.key() == QtCore.Qt.Key_Escape:
              self.close()
  
      @pyqtSignature("")
      def on_pbClose_clicked(self): # this is the "close" pushbutton. Whe i click it, the QWidget only hide. I need to close it, like if I click on It's "X" button
          self.deleteLater()
          self.close()
  
  if __name__ == "__main__": 
      App = QtGui.QApplication(sys.argv)
      frm = MainWindow()
      sys.exit(App.exec_())
  </code></pre>