[Qt-interest] Problem with Layout, it does not resize itself
Maximilien Renard
iixamaxii at gmail.com
Wed Feb 17 15:31:44 CET 2010
Hi !
So, setWidgetResizable(true) on the scrollArea has solved the problem
concerning the strange aspect of the widgets but the behaviour is still not
what I expect.
www.ixamaxi.be/images/problem-layout1.png
www.ixamaxi.be/images/problem-layout2.png
1) The label above the form Layout expands when I resize the MainWindow but
not the formLayout.
2) I'd like the MainWindow to grow when I add widgets to the formLayout and
the scrollArea would only "appear" when the MainWindow can not grow anymore.
Is this possible ?
Thanks a lot for your answers and your further help !
Maximilien
On 17 February 2010 14:07, Christian Gagneraud <cgagneraud at techworks.ie>wrote
> On 02/17/2010 12:14 PM, Maximilien Renard wrote:
> > Dear Qt Users,
> >
> > I'm having some trouble using layouts.
> >
> > Basically, this is what I have in a widget which is in a QScrollArea
> > which is set as the centralWidget of my MainApplication :
> >
> > Widget::Widget() : QWidget() {
> > QVBoxLayout * vBoxLayout = new QVBoxLayout;
> > QLabel * label = new QLabel("LABEL");
> > vBoxLayout->addWidget(label);
> > QFormLayout * formLayout = new QFormLayout;
> > formLayout->addRow("LOL", new QLineEdit());
> > formLayout->addRow("WAT", new QLineEdit());
> > formLayout->addRow("WOW", new QLineEdit());
> > vBoxLayout->addLayout(formLayout);
> > setLayout(vBoxLayout);
> > }
> >
> > And this is (not the example but the code isn't that much different)
> > what I get when I resize the QMainWindow. On the screenshot you can also
> > see what is happening when I add a widget into either one of both
> > layouts (existings widgets become smaller since the layout is not
> resized).
> >
> > http://www.ixamaxi.be/images/problem-layout.png
>
> I can see on this screenshot that you do this onn your layouts:
> layout->setSizeConstraint(QLayout:SetNoConstraint)
>
> I think you shouldn't do this, let the layout manage sizes for you.
>
> My 2 cents.
> Chris
>
> >
> > Could someone explain me what is happening ?
> >
> > Thank you very much.
> >
> > Best regards
> > Maximilien Renard
> > ULB - MA1 Ingénieur Civil Biomédical
> > maximilien.renard at ulb.ac.be <mailto:maximilien.renard at ulb.ac.be>
> > +32 476 63 68 92
> >
> >
> >
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
Maximilien Renard
ULB - MA1 Ingénieur Civil Biomédical
maximilien.renard at ulb.ac.be
+32 476 63 68 92
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100217/7dfe57df/attachment.html
More information about the Qt-interest-old
mailing list