Nominate our 2022 Qt Champions!

Getting SplitterBar to use all the space available

  • QtDesigner :

    I have been trying to get a splitter bar working with a QMainWindow.

    The main windows has a central Widget called centralWidget.

    To that I added a QWidget and a QStackedWidget

    I then selected them both and selected to lay them out horizontally in a splitter.

    I expected the Splitter to fill the space availbale in the central widget, but it didn't ... Do I need to apply a layout the centralWidget as well?

    Update: Looks like the answer to that is YES I do. Somewhat surprised, but if that's what's needed!

  • Lifetime Qt Champion


    The splitter should be the central widget. Then you will get the result you are looking for.

  • Strange because I can't delete the central Widget so how can I replace it with a splitter?

  • Lifetime Qt Champion

    Sorry, I am used to build UI 100% in code.

    I do not remember if you can replace the central widget in designer. If that is not the case, you can change it in the .ui file directly.

Log in to reply