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

Andreas Pakulat apaku at gmx.de
Thu Nov 3 21:34:44 CET 2011


On 03.11.11 16:11:39, Yifei Li wrote:
> 
> 
> On Nov 3, 2011, at 2:52 PM, Andre Somers wrote:
> 
> > 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,
> You can't set a layout for a QDockWidget, although setLayout method exists for QDockWidget.
> I have tried this, 
> 1) set a layout for QDockWidget
> 2) add widgets to the layout
> 3) NOTHING shows up in the QDockWidget
> 
> I don't understand why.

Then create a small self-contained compilable example showing the
problem.  Either you'll discover your error while doing so or someone
here will likely be able to point it out.

Andreas




More information about the Qt-interest-old mailing list