PDA

View Full Version : QDockWidget : docking, reopening after closing



kghose
14th July 2008, 02:21
Hi!

I have a QMainWindow with a QDockWidget in it generated through Designer. I figured out that after floating the widget, double clicking on the dockwidget will redock it in the original place. I can not however figure out how:

To redock the widget anywhere on the main window
reopen the dockwidget after I close it


Any help in much appreciated.
-K

munna
14th July 2008, 07:06
To redock the widget anywhere on the main window

Just dragging and dropping the widget in the dock area should re-dock it again. Make sure allowedAreas is set to Qt::AllDockWidgetAreas


reopen the dockwidget after I close it
When the dock widget is closed, its hidden and visibilityChanged singnal is emitted. I think you will need to write your own code to make it visible again (setVisible).

jpn
14th July 2008, 11:58
Notice also QDockWidget::toggleAction() which you can for example put to some menu.

kghose
14th July 2008, 20:22
Thanks Guys! show() works just fine. I mistakenly though close() destroyed the window rather than just hid it.

But... I still can't dock my window anywhere I want. I have "allowedAreas" set to Qt::AllDockWidgetAreas (via Designer AND in the constructor).

-K