There are many posts similar to this one, all slightly different but haven't managed to get it working.

I have a QMainWindow that contains a QScrollArea. I would like the window to resize to the minimal size that fits the scroll bar content (thus, not needing the scrollbars), but preventing the window to overflow the resolution.

A more precise explanation of what I want to achieve is also posted this stackoverflow post: http://stackoverflow.com/questions/1...th-qscrollarea

Temporarly I've solved it setting a window size big on QtDesigner enough to fit the contents. I've tried changing the size policies all over the hierarchy, neither Ignored nor the Expandings worked. I've tried calling adjustSize() on the mainWindow or the scrollArea and also using the sizeHint of the scrollArea on the QMainWindow resize. To no avail.

Cheers!