title: PyQt keep aspect ratio fixed
body: <p>I'm working on a PyQt5 GUI, so far, I've just had experience with python scripts and did not delve into creating user interfaces.</p>
  
  <p>The GUI will have to be used on different screens (maybe also some old 4:3 ratio screens) and will need to look nice in different sizes.
  Now, my approach to make my life easier was to enforce a fixed aspect ratio of the window and resize the different elements according to window size.</p>
  
  <pre><code>from PyQt5 import QtCore, QtGui, QtWidgets
  
  class MainWindow(QtWidgets.QMainWindow):
      def __init__(self, parent= None):
          super().__init__(parent)
          self.form_widget = FormWidget(self)
          self.setCentralWidget(self.form_widget)
          self.resize(200, 400)
          self.sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
          self.sizePolicy.setHeightForWidth(True)
          self.setSizePolicy(self.sizePolicy)
  
      def heightForWidth(self, width):
          return width * 2
  
  class FormWidget(QtWidgets.QWidget):
  
      def __init__(self, parent):
          super().__init__(parent)
  
      def resizeEvent(self, event):
          f = self.font()
          temp = event.size().height()
          f.setPixelSize(temp / 16)
          self.setFont(f)
  
          return super().resizeEvent(event)
  
  
  if __name__ == "__main__":
      import sys
      app = QtWidgets.QApplication(sys.argv)
  
      w = MainWindow()
      w.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>Resizing the elements according to window size works fine, but window aspect ratio is not kept at all.
  I copied this approach with <code>heightForWidth</code> from old PyQt4 threads. Doesn't this approach work anymore in PyQt5? Am I missing something?</p>