Important: Please read the Qt Code of Conduct -

Centralwidget: as small as possible

  • Hi guys,

    at startup my mainwindow has no dockwidgets. Only a label as centralwidget with one line of text. This label populates the whole windows area as expected. The user can add dockwidgets. As soon as the first dockwidget is created, I'd like my centralwidget to shrink to it's minimum size at the top of the main window. I'm messing around with sizePolicies but don't get it done. Is there a way to tell a widget to take as much space a possible?

    Thank you and cheers,


  • the central widgets get always the complete space of the main window which is not covered by dock areas. You might want to add some spacers to "squeeze" the label into the desired place.

Log in to reply