title: How to control QGroupBox resizing
body: <p>The code below creates a single dialog with <code>GroupBox()</code> resizing in sync with the dialog. This is default resizing policy for GroupBox. How to change this policy so <code>GroupBox</code> occupies as little space (area) as possible and never expands vertically. How to achieve it?</p>
  
  <p><a href="https://i.stack.imgur.com/bsOv6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bsOv6.png" alt="enter image description here"></a></p>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  app = QtGui.QApplication([])
  
  panel=QtGui.QDialog()
  panel.setLayout(QtGui.QVBoxLayout())
  
  groupbox = QtGui.QGroupBox('Group Box')
  groupbox.setLayout(QtGui.QVBoxLayout())
  panel.layout().addWidget(groupbox)
  
  for i in range(3):
      row = QtGui.QHBoxLayout()
      row.addWidget(QtGui.QLabel('Label'))
      row.addWidget(QtGui.QLineEdit())
      row.addWidget(QtGui.QPushButton('Push Button'))
      groupbox.layout().addLayout(row)
  
  panel.layout().addWidget(QtGui.QPushButton('Confirm'))
  
  panel.show()
  app.exec_()
  </code></pre>