title: PyQt's QMainWindow closeEvent is never called
body: <p>I'm using pyqt4 in python.<br/>
  When I close the QMainWindow window , its not handled by <code>closeEvent</code> method. 
  Please someone tell me what is wrong with this code:</p>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          MainWindow.setObjectName("MainWindow")
          MainWindow.resize(277, 244)
          self.centralwidget = QtGui.QWidget(MainWindow)
          self.centralwidget.setObjectName("centralwidget")
          MainWindow.setCentralWidget(self.centralwidget)
          self.statusbar = QtGui.QStatusBar(MainWindow)
          self.statusbar.setObjectName("statusbar")
          MainWindow.setStatusBar(self.statusbar)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
      def closeEvent(self,event):
          result = QtGui.QMessageBox.question(self,
                        "Confirm Exit...",
                        "Are you sure you want to exit ?",
                        QtGui.QMessageBox.Yes| QtGui.QMessageBox.No)
          event.ignore()
  
          if result == QtGui.QMessageBox.Yes:
           event.accept()
  if __name__ == "__main__":
      import sys
      app = QtGui.QApplication(sys.argv)
      MainWindow = QtGui.QMainWindow()
      ui = Ui_MainWindow()
  </code></pre>