title: PyQt4 Mdi sub window not resizing properly
body: <p>In the following example, when you click the button, the entire form is rebuilt adding a new label each time. At the end is a resize call that doesn't appear to work. While debugging, I validated the <code>sizeHint()</code> is returning the correct dimensions, and internally the widget thinks it is the correct size, but what is drawn is not correct. What can I do to force the MDI window to resize correctly? Also of note, when not sized correctly, if you manually start resizing, it suddenly snaps to the appropriate size.</p>
  
  <pre><code>import sys
  import os
  
  from PyQt4.QtCore import *
  from PyQt4.QtGui import *
  import PyQt4.Qt
  
  class MdiWindow(QMainWindow):
      def __init__(self, parent=None):
          super().__init__(parent)
          self.count = 0
          self.buildWindow()
  
      def buildWindow(self):
          main = QVBoxLayout()
  
          button = QPushButton('Change Count')
          button.clicked.connect(self.changeCount)
          main.addWidget(button)
  
          for i in range(self.count):
              main.addWidget(QLabel(str(i)))
  
          widget = QWidget()
          widget.setLayout(main)
          self.setCentralWidget(widget)
  
          self.resize(main.sizeHint())
  
      def changeCount(self, event):
          self.count += 1
          self.buildWindow()
  
  class MainWindow(QMainWindow):
      def __init__(self):
          super().__init__()
          self.setWindowTitle('Resize Test')
          self.mdiArea = QMdiArea()
          self.setCentralWidget(self.mdiArea)
  
          child = MdiWindow()
          self.mdiArea.addSubWindow(child)
  
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      mainWin = MainWindow()
      mainWin.show()
      sys.exit(app.exec_())
  </code></pre>