Important: Please read the Qt Code of Conduct -

QStackedLayout and QStackedWidget always taking all available space

  • I'm adding permanent widgets to my QMainWindow's status bar. When I add a label or some widget that I create deriving from QWidget, they only take the space needed, and that's exactly how I wanted it.
    When I tried a QStackedWidget, it would always take the entire space available. Then I tried to change it's SizePolicy to no avail. Then I tried to create a QWidget with a QStackedLayout and got the same result. I tried even to derive QStackedLayout and change some stuff and nothing..
    What do I need to do for the QStackedLayout/QStackedWidget to take only the space it needs?