If your widget is just a small part of your application, I would suggest the same as the first comment. You have to use
QMainWindow
and then add
QDockWidget
to the main window.
// ... QMainWindow* window = new QMainWindow(); // ... QDockWidget* dockWidget = new QDockWidget( "Your DockWidget" ); window->addDockWidget( Qt::LeftDockWidgetArea, dockWidget ); // ...
But if this does not meet your needs, you need to implement your own algorithm for this purpose.
source share