hgiese
4th September 2009, 15:04
Hello out there,
I want to line up some widgets in a "row":
- flush left: a combo and a label
- flush right: 2 buttons
and a spacer in between to fill out the remaining space.
The goal: If the parent of the "line" shrinks or grows, the widgets on the left resp. right side should stay flush left (right) and the spacer in the middle should take care of the space in the middle. I thought that a horizontal layout would be what is needed but apparently I am wrong.
If you look at image 1 you see the widgets lined up in a frame. Note that the combo and the buttons have their original/default width reduced.
In image 2 I have a horizontal layout applied to them:
- The whole "line" now extends way beyond the parent's width, and
- the combo as well as the buttons returned to their default width.
2 questions please:
- What is the "Qt way" of achieving what I want: 2 widgets stay on the left, 2 on the right, their sizes do not change and the middle part takes care of the remaining space?
- Since I evidently do not use Qt's layouts the way they are intended to be used: Where can I learn how to use them?
Any help will be greatly appreciated.
Best regards
Helmut Giese
I want to line up some widgets in a "row":
- flush left: a combo and a label
- flush right: 2 buttons
and a spacer in between to fill out the remaining space.
The goal: If the parent of the "line" shrinks or grows, the widgets on the left resp. right side should stay flush left (right) and the spacer in the middle should take care of the space in the middle. I thought that a horizontal layout would be what is needed but apparently I am wrong.
If you look at image 1 you see the widgets lined up in a frame. Note that the combo and the buttons have their original/default width reduced.
In image 2 I have a horizontal layout applied to them:
- The whole "line" now extends way beyond the parent's width, and
- the combo as well as the buttons returned to their default width.
2 questions please:
- What is the "Qt way" of achieving what I want: 2 widgets stay on the left, 2 on the right, their sizes do not change and the middle part takes care of the remaining space?
- Since I evidently do not use Qt's layouts the way they are intended to be used: Where can I learn how to use them?
Any help will be greatly appreciated.
Best regards
Helmut Giese