how to set QDockWidget location
-
Hello everyone, can someone tell me if it possible to place dockwidget like on pic
- control panel can be placed on the left or right side, but it must be up to the bottom
- work panel can be placed under the central widget or above, or floatable
now i have the code:
control panel:
setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); setFeatures(features() ^ QDockWidget::DockWidgetClosable ^ QDockWidget::DockWidgetFloatable);
work panel :
setAllowedAreas(Qt::BottomDockWidgetArea); setFeatures(features() ^ QDockWidget::DockWidgetClosable);
and mainwindow:
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); addDockWidget(Qt::BottomDockWidgetArea, work_panel); addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, control_panel, Qt::Vertical);
and its dont work, any ideas?
-
-
@SGaist code above works with minor changes, but only in the mingw 5.15.2 x32 compiler
changes:
control panel://setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); all areas setFeatures(features() ^ QDockWidget::DockWidgetClosable ^ QDockWidget::DockWidgetFloatable);
of course it work not fully right, control panel can placed at any corner, but i think i can connect to QDockWidget::dockLocationChanged and place it like i need after drag