PDA

View Full Version : Alignment issue



tebs
24th April 2007, 13:11
Hey, this is probarly pretty obvious, and is just a case of me missing something (I've looked, I swear) but..

I want to have a vertical row of labels, with horizontal lines aligned beside them.
This image is my closest approximation:
http://www.photodump.com/direct/footstool/alignment.jpg

Now, this would be perfect if I could make the right column (the one with the horizontal lines in it) larger than the left, but as it stands, they're always equal and I can't see how to change that, leaving a big space between the text and the line.

I've tried various combinations of box layouts, including two vboxes (one for labels, one for lines) and putting them beside each other, but the height differences between the label and line mean only one or two are ever aligned.

Is there a 'sensible' way to do this, or should I just use a bit of maths to align everything, and use the window as a canvas?
Preferably a solution I could do from within qtdesigner and then see how the code works.

marcel
24th April 2007, 13:13
Why don't you use addStretch and QSpacerItems with your layout? With the correct combination you could achieve the proposed result.

Regards

tebs
24th April 2007, 13:34
Ah, yes. I tried spacers earlier, but they only seemed to make it more unpredictable and difficult, but with a bit more dilligence, I did get something pretty close to what I wanted.
Thanks very much.

wysota
24th April 2007, 14:44
You can also change the size policy of the items and the horizontal stretch. It will allow you to define proportions between the columns.