[Qt-interest] Problem with Layout, it does not resize itself

Maximilien Renard iixamaxii at gmail.com
Tue Feb 23 00:16:38 CET 2010


Hi !

Thank you for answers.

I've just stumbled upon something interesting : adjustSize(). I've just
tried that and it does exactly what I want. Well, sadly, not exactly...

I've changed the structure of my program and it's like this now :

QApplication
-> QMainWindow
----> Form
-------> QVBoxLayout
----------> QLabel * message;
----------> QScrollArea
-------------> QGroupBox
----------------> QFormLayout
----------> QHBoxLayout * buttons;

When I call adjustSize() on the QScrollArea and Form, QScrollArea is in fact
resized and the widget contained in it is visible (Form is resized too). But
the QMainWindow is not resized and for example buttons layout disappear at
the bottom of the QMainWindow.

Since the Form will not always be the centralWidget of the QMainWindow, it
is not possible for me to call, adjustSize() on the parent widget, and then
on the parent widget's parent,...

Basically what I'm trying to do, is to resize the whole QMainWindow to avoid
sliders to appear on the scrollArea until the window cannot be resized
anymore without being bigger than the screen.

What am I supposed to do ?

Thank you very much !

Maximilien

On 17 February 2010 16:23, Stephen Collyer <scollyer at netspinner.co.uk>wrote:

> On 17 February 2010 15:01, Christian Gagneraud <cgagneraud at techworks.ie>wrote:
>
>>
>> I don't really understand what you trying to do, but I would say that
>> you shoudn't bother at all about sizes, resizing and scroll area.
>> Let the layouts manage all of these for you.
>>
>> Just create the widgets, add them to the layouts and finally use
>> setLayout(). Use all defaults values, don't use setWidgetResizable(),
>>
>
> He has the widget inside a QScrollArea. It won't resize correctly if he
> doesn't do
> setWidgetResizable(true), in my experience.
>
> --
> Stephen Collyer
>
> _______________________________________________
> 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/20100223/ac325042/attachment.html 


More information about the Qt-interest-old mailing list