[Qt-interest] remove dock widgets from a QMainWindow keeping the size of the central widget

Giacomo giacomo.strangolino at elettra.trieste.it
Wed Oct 28 09:40:27 CET 2009


Hi to all.

I have a QMain window with a central widget and 3 dock widgets on the left and 
2 on the right.
When a checkbox is unchecked, i findChildren<QDockWidget *>() and foreach 
dockWidget I close() it.

What I want is that the central widget is not resized to the size of the whole 
main window, but instead the main window resizes to the size of the central 
widget when docks are closed.

Currently, when I close the docks, just before closing them I calculate their 
widths and subtract them to the whole main window width to resize the main 
window after all docks are closed.

What happens doing like that is that the central widget sometimes receives a 
ResizeEvent of 0 width and this is not wanted by my central widget.

Thanks for any hint

Giacomo.

Elettra Synchrotron Radiation facility
Trieste - Italy




More information about the Qt-interest-old mailing list