[SOLVED] Why does Qt Designer add so much space?

Issue

Why does Qt make so much space? How can I fix this? I just want to create two labels, two text boxes and a login button. I’m trying to make a login form.

enter image description here

Something like this:
enter image description here

Why does it need so much space to just have small buttons?

enter image description here

This is the nicest I’ve been able to get it to look, but even this looks terrible.

Solution

Just add a Vertical Spacer to the top and the bottom, then you will have your expected result.

If you would like to add it through the code and not in Designer, you would need to add it on the QLayout with QBoxLayout::addStretch(int stretch = 0) or QBoxLayout::addSpacing(int size), depending on your need

Answered By – Mat

Answer Checked By – Mary Flores (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *