PDA

View Full Version : QDockWidget initial size



pl01
22nd March 2013, 09:44
Hi,

I use Qt Designer and try to set the initial size of a QDockWidget... but no way.

I have try the following :

- Change the sizes with the Qt Designer, it the designer it looks good but not when I launch the application.
- Play with the following methods : resize, updateGeometry, setGeometry, raise
- Implement sizeHint this way :
virtual QSize sizeHint() const
{
return QSize(247, 241);
}

Of course, I have try on both the QDockWidget and the child widget !

Only the setFixedWidth works... but then the width is fixed :-P

What is strange is that the 'window::restoreState' update the layout correctly !

Thanks

ChrisW67
23rd March 2013, 21:38
The initial size of the docked (I assume, you did not say) dock widget is set by the layout of the QMainWindow you insert it in. That size is constrained by maximum and minimum sizes you set on the dock content and central widgets but is otherwise under the control of the layout.

If you can provide a small example program that shows what you have done, explain what you expected, and how the result is not as expected, the perhaps we could give more specific guidance.