title: Add functionalities to buttons in PyQt5 QGroupBox
body: <p>So I wanted to add a button to a PyQt5 QGroupBox. The button will close the window before saving the parameters in class variables. How would I do this?
  My code:</p>
  
  <pre><code>def changeDefaultParameters(self):
      self.DPGroupBox = QGroupBox("Default Paramters:")
      self.DPGroupBox.setStyleSheet('QGroupBox  {color: blue; font:bold 14px}')
      self.DPGroupBox.move(300, 300)
      layout = QFormLayout()
  
      layout.addRow(QLabel("D (nm):"), QLineEdit())        
      layout.addRow(QLabel("R_on (\u03A9):"), QLineEdit())  
      layout.addRow(QLabel("R_off (\u03A9):"), QLineEdit())  
      layout.addRow(QLabel("W_0 (nm):"), QLineEdit())  
      layout.addRow(QLabel("Mobility (\u03BC):"), QLineEdit())  
      layout.addRow(QLabel("Polarity (\u03B7):"), QLineEdit())  
      layout.addRow(QLabel(), QPushButton('OK', self))
  
      # ADD SOMETHING HERE SO THAT WHEN OK IS CLICKED THE
        VALUES INPUT GETS SAVED SO CLASS VARIABLES LIKE:
        self.var1 = D
        ALSO THE WINDOW CLOSES
  
  
      self.DPGroupBox.setLayout(layout)
      self.DPGroupBox.show()
  </code></pre>
  
  <p>Currently it looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/2t2nM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2t2nM.png" alt="enter image description here"></a></p>