title: Qt - How to set minimum size on a container so it doesn't distort children
body: <p>I have a QWidget container (actually a QFrame) with a few widgets inside. The contents of this container (the number and/or size of the child widgets) may change dynamically. The container itself is in a scrollarea.</p>
  
  <p>Generally, the container is properly resized (grown or shrunk) according to its contents. This works.</p>
  
  <p>However, I also need to set a minimum size on this container so it doesn't shrink too much. That is, the container's minimum size should be:
  <code>max(my_minimum_size, contents_size)</code>.
  This is where it becomes problematic.</p>
  
  <p>If I use
  <code>container-&gt;setMinimumSize(200, 200);</code>
  and the size of the contents is greater than (200, 200), the container can still be resized to (200, 200) (unlike before), with its contents size ignored and being distorted or chopped off.</p>
  
  <p>Is there a way to fix this? I'm using Qt 5.9.</p>
  
  <p><strong>Update:</strong> This <a href="https://pastebin.com/P1dXgAXh" rel="nofollow noreferrer">Qt Designer UI file</a> shows exactly what I mean. There is a <code>minimumSize</code> set on a container, and resizing it distorts the buttons.</p>