QScrollArea with dynamically changing contents

The essential steps are: The container widget that holds the buttons (your CheckableButtonGroup) must have a QLayout::SetMinAndMaxSize size constraint set. Then it will be exactly large enough to hold the buttons. Its size policy doesn’t matter, since you’re simply putting it into a QScrollArea, not into another layout. The scroll area needs to set its … Read more

How do i resize the contents of a QScrollArea as more widgets are placed inside

If you’re coming here from Google and not having luck with the accepted answer, that’s because you’re missing the other secret invocation: QScrollArea::setWidget. You must create and explicitly identify a single widget which is to be scrolled. It’s not enough to just add the item as a child! Adding multiple items directly to the ScrollArea … Read more