title: Reloading stylesheet helps resizing QStackedWidgets
body: <p>Stacked Widgets don't have the possibility to update the size to the minimum size of the contents current shown. 
  It always shows the biggest size of the biggest layer and stays there as long as the QSizePolicy stays the same.</p>
  
  <p>An aproach i found long time ago was to use a function like this:</p>
  
  <pre><code>void SmartUIWrapper::updateStackedWidgetSize( QStackedWidget* stacked, int index )
  {
    // Set to size policy ignored for the rest of pages. Set expanding to the actual one
    for (int i = 0; i &lt; stacked-&gt;count (); ++i)
    {
      // determine the vertical size policy
      QSizePolicy::Policy policy = QSizePolicy::Ignored;
      if (i == index) 
        policy = QSizePolicy::Expanding;
  
      // update the size policy
      stacked-&gt;widget (i)-&gt;setSizePolicy(QSizePolicy::Fixed, policy);
    }
  }
  </code></pre>
  
  <p>It sets all elements to Ignored, and then it sets the vertical policy of the selected widget which is Expanding (or whatever you want).</p>
  
  <p>Later on i found out that reloading the styletheet updates the current sizes and makes the widget to resize to the minimum. But this approach is way too slow and unnecessary.</p>
  
  <p>Do you know any other way to update the size to shrink to the smallest size in the current layer shown?</p>