PDA

View Full Version : QDockWidget size policy



Caius Aérobus
2nd March 2011, 16:08
I create a widget with a vertical layout and a number of items.
If I put it in a MainWindow, everything goes right.
If I put it in a QDockWidget which I make floating, the items are shrinked as a function of their position in the layout (the bottom being schrinked more and the top ones being expanded).
Actually the whole widget seems not to get the right size, ie the sum of all its children sizes but is smaller.
Where is the problem?

QDockWidget *dock = new QDockWidget;
QWidget *ww = new QWidget();
dock->setWidget(ww);
this->addDockWidget(Qt::TopDockWidgetArea, dock);
dock->setFloating(true);
QVBoxLayout *Layout = new QVBoxLayout();
Layout->setMargin(LAYOUT_MARGIN);
Layout->setSpacing(LAYOUT_MARGIN);
ww->setLayout(Layout);
...