title: Qt size policy and stretch factors
body: <p>How do the options size policy and stretch factors influence the size of a widget? </p>
  
  <p>The image below shows previews of three differently arranged windows. For all three windows (W1-W3) the widget on the right is a QFrame widget with the horizontal and vertical size policies set to <em>Preferred</em> (this is the default setting). The horizontal stretch factor is set to <em>2</em>. The widget on the left is a QListView widget which also has the size policies set to <em>Preferred</em> (by default this would be Expanding) and the horizontal stretch factor set to <em>1</em>.</p>
  
  <p><a href="https://i.stack.imgur.com/uMBiA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uMBiA.png" alt="Different layouts"></a></p>
  
  <p>The three windows differ in the way the two widget are layout against each other.</p>
  
  <ol>
  <li>(W1) The window on the left in the image above has a central widget set to a horizontal layout resulting in a size ratio of 2/3 of the widgets that I would expect because of the stretch factors set to <em>2</em> and <em>1</em>.</li>
  <li>(W2) The two widget are "connected" with each other through a QSplitter widget. The central widget is set to t horizontal layout. The results of the size of the widgets differ from W1 and are not in the ratio of 2/3.</li>
  <li>(W3) The right window "connects" the two widget also with a QSplitter like in window W2. Howevert, The QListView widget is child to a QVBoxLayout. So the QSplitter has the QFrame and a QVBoxLayout as its children.</li>
  </ol>
  
  <p>In detail the setup for the three different windows is shown in the image below:</p>
  
  <p><a href="https://i.stack.imgur.com/JXzgg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JXzgg.png" alt="enter image description here"></a></p>
  
  <p>I have the following questions:</p>
  
  <ul>
  <li>Why do the ratios of the two widgets differ between W1, W2 and W3?</li>
  <li>The ratio in W2 seems to be affected by the stretch factors, however not with the results expected. But W3 does not seem to be influenced by the stretch factors at all. Why is that the case?</li>
  </ul>