[Qt-interest] Qt-interest] Problems with alignment in QVBoxLayout
John Posner
jjposner at optimum.net
Wed Feb 17 15:19:49 CET 2010
On 2/17/2010 3:58 AM, alexander golks wrote:
> perhaps you missed a param for QBoxLayout::addWidget(...) call:
>
> lay.addWidget(Btn("one"),0,Qt.AlignRight)
> lay.addWidget(Btn("two two two two two"),0,Qt.AlignRight)
>
>
Yes, Alex, that does the job! In fact, it works if I add the stretch=0
argument just to the first button ("one"). I didn't think of
manipulating the stretch, because I wanted to *move* the button, not
change its size. I guess I'll need to understand better the interaction
between specifying QSizePolicy.Fixed and a 0-sized stretch:
"If the stretch factor is 0 and nothing else in the QBoxLayout has a
stretch
factor greater than zero, the space is distributed according to the
QWidget:sizePolicy() of each widget that's involved."
Many thanks,
John
More information about the Qt-interest-old
mailing list