I create a dockwidget from some other widget, and it seems to work, but it can not be docked to a main window afterwards. And I can not call addDockWidget simply because there is no way to get a pointer to application's main window in qt4. What is the proper way to accomplish that?