PDA

View Full Version : QDockWidget Close instead of Collapse



GimpMaster
9th February 2010, 17:26
I would like it so that when a QDockWidget's "x" is pressed the Dock widget closes instead of collapses.

I tried attaching a slot to the visibilityChanged and then tested whether it was invisible and deleting it but since the visibility changes briefly when going between docked and floating that's not the best solution.

Any other thoughts? Can I catch the event when the user presses the "x" in a dock widget?

Thanks

LaOnze2000
9th February 2010, 23:01
This is what I do :

QDockWidget *dk=new QDockWidget(mainWindow);
dk->setAttribute(Qt::WA_DeleteOnClose,true);
So when you hit the "x" it deletes the dockwidget and
all children.

Hope this is what you wanted.
Murielle