title: How to avoid the child QMainWindow disappearing?
body: <p>When I click the button, "ChildWindow" will flash and disappear. Then If I add the function exec_(), it will report an "AttributeError" because "QMainWindow" don't have this attribute. 
  How to modify the function "showChildWindow" so that it can work well? Thank you.</p>
  
  <pre><code>import sys
  from PyQt4 import QtCore, QtGui
  
  class MainWindow(QtGui.QMainWindow):
      def __init__(self, parent=None):
          QtGui.QWidget.__init__(self, parent)
          self.setWindowTitle("MainWindow Window!")
          self.setGeometry(400, 400, 100, 100) 
          self.centerWidget = QtGui.QWidget()
          self.setCentralWidget(self.centerWidget)
  
          self.pushButton = QtGui.QPushButton("&amp;Button")
          layout = QtGui.QVBoxLayout()
          layout.addWidget(self.pushButton)
          self.centerWidget.setLayout(layout)    
  
  class ChildWindow(QtGui.QMainWindow):
      def __init__(self, parent=None):
          QtGui.QWidget.__init__(self, parent)
          self.setWindowTitle("Child Window!")
  
  def showChildWindow():
      mw = MainWindow()
      child_win = ChildWindow(mw)
      child_win.show() 
      #child_win.exec_()                     #AttributeError: 'ChildWindow' object has no attribute 'exec_'
  
  if __name__ == "__main__":
      app = QtGui.QApplication(sys.argv)
      myapp = MainWindow()
      myapp.show()
      QtCore.QObject.connect(myapp.pushButton,QtCore.SIGNAL("clicked()"),showChildWindow)  
      sys.exit(app.exec_())
  </code></pre>
  
  <p>This program can work well.</p>
  
  <pre><code>import sys
  from PyQt4 import QtCore, QtGui
  
  class MainWindow(QtGui.QMainWindow):
      def __init__(self, parent=None):
          QtGui.QWidget.__init__(self, parent)
          self.setWindowTitle("MainWindow Window!")
          self.setGeometry(400, 400, 100, 100) 
          self.centerWidget = QtGui.QWidget()
          self.setCentralWidget(self.centerWidget)
  
          pushButton = QtGui.QPushButton("&amp;Button")
          layout = QtGui.QVBoxLayout()
          layout.addWidget(pushButton)
          self.centerWidget.setLayout(layout)
  
          QtCore.QObject.connect(pushButton,QtCore.SIGNAL("clicked()"),self.showChildWindow)      
  
      def showChildWindow(self):
          self.child_win = ChildWindow(self)
          self.child_win.show()
  
  
  class ChildWindow(QtGui.QMainWindow):
      def __init__(self, parent=None):
          QtGui.QWidget.__init__(self, parent)
          self.setWindowTitle("Child Window!")
  
  if __name__ == "__main__":
      app = QtGui.QApplication(sys.argv)
      myapp = MainWindow()
      myapp.show()
      sys.exit(app.exec_())
  </code></pre>