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.
Why does it need so much space to just have small buttons?
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)
orQBoxLayout::addSpacing(int size)
, depending on your need
Answered By – Mat
Answer Checked By – Mary Flores (BugsFixing Volunteer)