Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, August 2007
Widget size management


Message 1 in thread

Dear all,


I am unable to obtain the desired behavior when resizing a (rather simple)
widget.

The parent of my widget has no layout (the widget size and position are set
programatically).


The widget features :
- top left : a tool button toolbutton
- top righet : a label label1. Its size hint is QSize(0,0)
- bottom : a label label2. Its size hint is QSize(0,0)

The widget's QStyle is CleanLook.

The widget is resizable by the user (as in the Qt Designer).


I'd need the labels to be resized prioritarily ; the button's size should
begin to be reduced only once the labels have disapeared.

In other words, toolbutton should prioritarily keep its sizeHint().

But I am unable to obtain this rather simple behavior, though I've tried
almost everything (probably not everything though ;=)) in the size policies
of all the widgets.


When reducing the height of the widget, once the height of label2 has
becomed equal to the height of toolbutton, 
toolbutton and label2 keep the same height ; label2 does not progressively
"disppear" as I'd like it to.



A strange thing is :
when I provide no parent to my widget (=> displayed in a MainWindow), its
behavior uppon resizing is correct.
The problem appears only when my widget is a (hand-made placed) widget of a
parent widget.



I know this problem is rather silly, and should be easily managed, but... I
woudl appreciate any help.

Very best-
Nicolas

--
 [ signature omitted ] 

Message 2 in thread

Nicolas Castagne schrieb:
> Dear all,
> ...
> The parent of my widget has no layout (the widget size and position are set
> programatically).

But it needs one. Else the size hints of the child widgets are never 
evaluated.

Cheers, Oliver

--
 [ signature omitted ] 

Message 3 in thread

Hi all,

Thx much Oliver.

> But it needs one. Else the size hints of the child widgets are never
> evaluated.

OK. Rather strange though.

My parent frame (a QFrame, in fact) is, indeed, not layouted in its parent.

But the frame's children are layouted in the frame, in a QVBOxLayout.

When resizing the frame, the frame's children are resized in an almost
satisfying manner, since they are layouted in the frame, and even if the
frame itself is not layouted in its parent.


But only "almost", unfortunately.

When the height of the frame gets small, the toolbutton and the label inside
the frame get the same height, that goes smaller and smaller.

COnversely, I'd need :
- the label to desapear first
- the toolbutton to keep its maximal size (its sizeHint()) until the frame
gets smaller than this size hint.

I am very sure it is possible.... But how ? that's the trick !

Best-
Nicolas


Till Oliver Knoll wrote:

> Nicolas Castagne schrieb:
>> Dear all,
>> ...
>> The parent of my widget has no layout (the widget size and position are
>> set programatically).
> 
> But it needs one. Else the size hints of the child widgets are never
> evaluated.
> 
> Cheers, Oliver
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ]