Whenever a widget on a different index is shown (i.e. whenever currentChanged(int) is emitted), i would like for the stackedwidget to resize itself according to the minimize size of the current widget. By default, QStackedWidget uses the biggest widget in the stack to determine the size of the stackedwidget. I have tried multiple attempts, ranging from size policies, size constraints to size hints, both from the stackedwidget itself to even the child widgets in hopes of achieving the desired function. Unfortunately, nothing i have tried worked.

Assume at least the following structure:
Qt Code:
  1. QStackedWidget * stackedwidget = new QStackedWidget;
  2.  
  3. stackedwidget->addWidget(new QWidget);
  4. stackedwidget->addWidget(new QWidget);
  5.  
  6. stackedwidget->widget(0)->setMinimumHeight(100);
  7. stackedwidget->widget(1)->setMinimumHeight(200);
To copy to clipboard, switch view to plain text mode 
What would i have to do in order to achieve my goal? I am out of ideas.