PDA

View Full Version : Layout not updated when sizeHint changes



ArmanS
22nd April 2009, 16:51
Hi All,

I have a QVBoxLayout with QWidget derived class which are overrideing sizeHint. The size policy for my widgets is Fixed. When I create a widget and insert it into my layout, the later process the widget's size correctly (i.e. it considers sizeHint). However when later the widget changes the value of its sizeHint the layout is not getting updated. I tried QWiddget::updateGeometry (for the parent widget of layout), and QLayout::update but neither one solved give an effect.

How to update the layout.

P.S. when I destroy and recreate the layout the widget sizes are shown ok, but this is very heavy operation so I don't want to go through this way.

Thnx!

jlemaitre
23rd September 2010, 15:31
Hi,

The modified widget must notify the layout it has changed using QWidget::updateGeometry(). Doc says:


Notifies the layout system that this widget has changed and may need to change geometry.

Call this function if the sizeHint() or sizePolicy() have changed.

(You must call it from within the modified widget.)

Julien