Nominate our 2022 Qt Champions!

QVBoxLayout - no stretch/expanding

  • Hi,

    I have a QScrollArea with a QBoxLayout. At runtime I insert widgets into the scroll area using insertWidget(0,widget). I want the widgets to be listed directly below each other, but instead they are centered with space around them. How can I change that?

    Thanks for any hints,

    Best regards,


  • The space around them is controlled by the spacing parameter of the layout. Change that property in your layout to 0.

Log in to reply