Important: Please read the Qt Code of Conduct -

QtCreator - resizing elements inside a layout

  • Hello,
    I'd like to add a simple "About" box to my application. I want it to contain a few lines (centered) and an OK button.

    I've aligned all these elements in a Vertical Layout, but now I'm unable to resize individual elements inside it(for example, the OK button which is stretched to the width of the window). When I select an element, I get a bright blue frame which I'm unable to resize, as opposed to the resizable dark blue which normally appears.

    What am I missing?

  • Add horizontal spacers around the button in the layout.

  • [quote author="andreyc" date="1407956315"]Add horizontal spacers around the button in the layout.

    Unfortunately, I can't. When I drag and drop one, it's added in a new line, stretched to full width, and similarly to the other elements I can't resize it.

  • Try this

    1. Break current layouts.
    2. Add horizontal spacer at left and right of the button
    3. Select the button and the spacers and create a horizontal layout.
    4. Deselect everything in a widget and create a vertical layout for the widget.

  • I guess that helped. Thanks :)

Log in to reply