title: How do i resize the contents of a QScrollArea as more widgets are placed inside
body: <p>I have a <a href="http://doc.qt.digia.com/4.7-snapshot/qscrollarea.html" rel="noreferrer">QScrollArea</a> Widget, which starts empty;</p>
  
  <p><img src="https://i.stack.imgur.com/pDzaQ.jpg" alt="empty QScrollArea"></p>
  
  <p>It has a vertical layout, with a QGridLayout, and a vertical spacer to keep it at the top, and prevent it from stretching over the whole scroll area;</p>
  
  <p><img src="https://i.stack.imgur.com/ykWc6.jpg" alt="QScrollArea in Qt Designer"></p>
  
  <p>Elsewhere in the program, there is a QTextEdit, which when changed, has its contents scanned for "species" elements, and then they are added to the QGridLayout. Any species elements which have been removed are removed too. This bit works;</p>
  
  <p><img src="https://i.stack.imgur.com/u9b23.jpg" alt="QScrollArea with strange scroll bar"></p>
  
  <p>I have turned the vertical scrollbar on all the time, so that when it appears it does not sit on top of the other stuff in there. Note that the scroll bar is larger than the scroll box already though, despite not needing to be.</p>
  
  <p>This is the problem. The scroll area seems to be preset, and i cannot change it. If i add more rows to the QGridLayout, the scroll area doesn't increase in size.</p>
  
  <p>Instead, it stays the same size, and squeezes the QGridLayout, making it look ugly (at first);</p>
  
  <p><img src="https://i.stack.imgur.com/BB6RU.jpg" alt="Squashed QGridLayout"></p>
  
  <p>And then after adding even more it becomes unusable;</p>
  
  <p><img src="https://i.stack.imgur.com/ikaXf.jpg" alt="unusable line edits"></p>
  
  <p>Note that again, the scroll bar is still the same size as in previous images. The first two images are from Qt Designer, the subsequent 3 are from the program running.</p>
  
  <p>If I resize the window so that the QScrollArea grows, then I see this:</p>
  
  <p><img src="https://i.stack.imgur.com/nwHfY.jpg" alt="dumb too small layout"></p>
  
  <p>Indicating that there's some layout inside the scroll area that is not resizing properly.</p>
  
  <p>My question is; <strong>what do I need to do to make the scrollable area of the widget resize dynamically as I add and remove from the QGridLayout?</strong></p>