PDA

View Full Version : use QFrame as addStretch():



tommy
26th January 2008, 16:22
Is it possible to replace addStretch() with a line in such a way that it is not the emptiness that pushes widgets apart on the layout but rather a line?
This is my line:


QLabel *vDivider1 = new QLabel;
vDivider1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
vDivider1->setLineWidth(2);

Can this be combined with layout->addStretch(); so that the line is stretched and pushes the widgets away from each other?

jpn
26th January 2008, 17:13
I'm not 100% sure if I understood the problem but I guess you could set an "expanding" size policy:

vDivider1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
PS. Wouldn't it be easier to use Qt Designer to handle all this? ;)

tommy
26th January 2008, 17:21
Yes, you understood the question 100% and you solved it!
Thanks very much!

P.S. Naah, I'm not a huge fan of Qt Designer.