How to vertically align two QLineEdits in independent layouts?
-
Firstly I'm sorry if this question has been asked before but after extensive research I haven't found a satisfying answer.
I've got the following widget set up:
All I want to do is to vertically align the two line edits and the following push buttons while keeping the alignment if the widget is resized. It should look something like this:
For this I've set a minimum size for both line edits and added horizontal spacers to the right of both layouts. This approach only works if the widget isn't resized, because the line edits now stretch at a different rate so the alignment isn't kept.
When I set the horizontal stretch size policy of both line edits to 1 this is the result:
If someone could show me the proper way to do this it would be highly appreciated.
-
@rctm
You cannot align the two edits in your picture because they have no relationship to each other, they are in two quite separate layouts.As @sierdzio has said you probably have to use a grid layout here, so that their widths can be related.
If you don't want to do that you could try something like: in each case, put the pushbuttons/radiobuttons to the right into their own horizontal layout (or widget with horizontal layout), and perhaps a layout for the line edit too. Then you would have two widgets/layouts in each case, and you might find that any extra space (from resizing) is distributed evenly between the two areas (line edit on the left, buttons on the right) which results in the line edits lining up. Don't know if that works/is easy, otherwise use grid layout.
-