View Full Version : forcing dock windows to dock?

9th August 2009, 03:55
my dock window is floating, i want to force it to dock without user interaction. how can i do that?


9th August 2009, 13:51
If you are using a QMainWindow, it has a method addDockWidget that will dock the docking window to one of its docking areas, Qt::LeftDockWidgetArea, Qt::RightDockWidgetArea, Qt::TopDockWidgetArea or Qt::BottomDockWidgetArea.

9th August 2009, 15:56
i do use a QMainWindow... and AddDockWidget and that works at the first call... but my question is now if i have my dockwidget floating and i want to return it docking without user interaction... how i can do that? (AddDockWidget does not return a floating dock to his dock when i try)

9th August 2009, 16:32
Ok, I just tried, and simply calling QDockWidget::setFloating with false will dock the thing back to its docking area.

If you want it docking on some other area, then you have to first assign it to its new area using QMainWindow::addDockWidget, and then 'unfloat' it.

(Sorry, for some reason I understood your question as "my docking window appears first undocked, and I want it to first appear docked").