title: Compose a PyQt5 UI from multiple classes
body: <p>I have an UI designed in QT Designer. It is formed from three tabs:</p>
  
  <p>1 - Test; 2 - Train Haar; 3 - Train Hog;</p>
  
  <p>In every tabs I have some buttons, or some lines, or some widgets,  but when I create the code to add functions to those buttons or widgets I want to have 3 classes for every tabs, one class only for first tab, one class only for second tab and so on.. 
  And a fourth class who call all three classes and compose my UI. I do not know how to do this, I need every classes to inherit from QMainWindow? I need to setupUi in every class?</p>
  
  <p>This is my current code:</p>
  
  <pre><code>import sys
  from PyQt5 import QtWidgets, QtCore, QtGui
  from Qt_designer_UI import Ui_MainWindow
  
  class Test(QtWidgets.QMainWindow):
      def __init__(self):
          super(Test, self).__init__()
          self.ui = Ui_MainWindow()
          self.ui.setupUi(self)
  
  class Train_Haar(QtWidgets.QMainWindow):
      def __init__(self):
          super(Train_Haar, self).__init__()
          self.ui = Ui_MainWindow()
          self.ui.setupUi(self)
  
  
  class Train_HOG(QtWidgets.QMainWindow):
      def __init__(self):
          super(Train_HOG, self).__init__()
          self.ui = Ui_MainWindow()
          self.ui.setupUi(self)
  
  
  class Compose_UI(QtWidgets.QMainWindow):
      def __init__(self):
          super(Compose_UI, self).__init__()
          self.ui = Ui_MainWindow()
          self.ui.setupUi(self)
          Test()
          Train_Haar()
          Train_HOG
  
  
  
  if __name__ == '__main__':
      app = QtWidgets.QApplication(sys.argv)
      window = Compose_UI()
      window.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/QYPlt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QYPlt.png" alt="enter image description here"></a></p>