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

Qt-interest Archive, December 2006
Qt4 layout problem, QWidget children shrinks on resize


Message 1 in thread

Hi,
I'm porting to Qt4 and get some exhausting problems.
I've a QWidget whit some child widgets (QLabel, QLineEdit, ...) in a 
QVBoxLayout.
If I scale down this widget at runtime the children shrinks to a very small 
height. But why, I think child widgets should take automatically as much 
space (in height) as they need! I've set back all minSizes to default so 
that this should not be a problem.
Did anyone have the same problem?

Thanks for help/advise,
Adrian 


--
 [ signature omitted ] 

Message 2 in thread

On 21.12.06 11:45:29, Adrian Roelli wrote:
> I'm porting to Qt4 and get some exhausting problems.
> I've a QWidget whit some child widgets (QLabel, QLineEdit, ...) in a 
> QVBoxLayout.
> If I scale down this widget at runtime the children shrinks to a very small 
> height. But why, I think child widgets should take automatically as much 
> space (in height) as they need!

Yes, but a label or line-edit might need very little minimum space. With
the resize you force them to be as little as they can be.

> I've set back all minSizes to default so 
> that this should not be a problem.

Well minimumSize normally is 0, so unless the minimumSizeHint function
gives other information each widget can be resized to 0 size.

If you need to preserve a specific minimum size use the minimumExpanding
size policy and set a reasonable minimum size.

Andreas

-- 
 [ signature omitted ]