Reputation: 535
I have a QDialog window like this and I want to delete the space between 'Length', 'n', 'm' and corresponding QLineEdit input boxes. How can I achieve that ?
Upvotes: 2
Views: 2436
Reputation: 4036
You have to decide what to do with the space you want to remove :
The point is : the space has to be somewhere except if you reduce the parent widget or enlarge some the inner widgets. Size-policy is useful to tell which widget should take the available space, spacers are useful to let empty space between widgets.
Upvotes: 0
Reputation: 120768
All you need to do is reset the alignment of the labels:
label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlighVCenter)
This can also be done in via the Property Editor in Qt Designer.
Upvotes: 1
Reputation: 895
If you use gridlayout, I am not sure why your output looks like that. Generally Qt will not leave huge empty space like that, There are three possibility I can think of:
Still, I would use a simple form layout in your application.
Upvotes: 1