Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How do I add a Lay Out Horizontally in Splitter inside a layout that's the same size as the widget?



  • I have been messing with Qt Designer for some time and I can't figure out how to add a splitter lay out inside my current layout that's the same size as the widget. Here is an image that better clarifies what I'm trying to do.

    image of qt designer

    With the two widgets selected in the picture, I right click and go to Lay out, but all the options are greyed out. I tried adding different widgets, like containers or other layouts to see if they would work but they did not.

    I want to be able to have my entire gui resize with the window but can't figure out how to get a splitter pane to do that.
    Any recommendations?



  • The widgets cannot be added to a splitter if they are already added to a layout.
    So you still need to break the grid layout of centeralWidget.



  • @johnratius said in How do I add a Lay Out Horizontally in Splitter inside a layout that's the same size as the widget?:

    I want to be able to have my entire gui resize with the window

    A layout should already achieve that.

    Is it the formLayout who do not resize ? That's probably because scrollArea take all the place by default. But you can change this behavior using layout stretch factors and/or widget size policies

    If you really need a splitter, I think the items you have selected (scrollArea, verticalLayout) are already in the layout horizontalLayout so this could be why you cannot put them in a splitter. You probably need to break horizontalLayout and replace it by a splitter from Qt Designer



  • @Gojir4 Currently the horizontalLayout layout does resize to the window. That's the first step done, but now I can't put two widgets inside the horizontal layout into a splitter layout. The options are greyed out.

    I tried breaking the horizontal layout to put the child widgets into a splitter layout but the options are still greyed out. Any ideas why? Am I not allowed to create a splitter layout with "window-sized" layout?

    Edit:
    I changed my layout to be a bit more simpler for now.
    alt text

    I sill don't have access to the splitter layouts even when I have groupboxes. I tried this when they did not have grid layout and with the grid layout. Nothing.

    If this changes anything, I am using Qt Designer, not the one inside Qt Creator. (I'm using VS + Qt Designer)



  • The widgets cannot be added to a splitter if they are already added to a layout.
    So you still need to break the grid layout of centeralWidget.



  • @Bonnie I see. I got it to work now. Thanks.


Log in to reply