[Qt-interest] widget in dockwidget do not get resized

Andre Somers andre at familiesomers.nl
Thu Nov 3 19:52:55 CET 2011


Op 3-11-2011 19:29, Yifei Li schreef:
> Hi all,
>
> I did two experiments:
>
> 1) add a QTextEdit directly to a QDockWidget, and the QTexEdit gets resized whenever its containing dock widget is resized
>
> 2) However, if I put a QTextEdit in a layout which is set to be the layout of some other  QWidget W, and then add the QWidget W to the dock widget, the widget W is not resized when I resize the dockwidget
>
> What should I do to make the widget W's change its size when the dock widget is resized?
>
Make sure that widget W is in a layout itself, and that you set this as 
the layout manager for your QDockWidget. Remember: every widget needs to 
be _in_ a layout, and every layout needs to be set _on_ another layout 
or on a widget.

André




More information about the Qt-interest-old mailing list