diff --git a/src/DockManager.cpp b/src/DockManager.cpp index f22fa4b..4b9b6c9 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -823,6 +823,16 @@ CDockAreaWidget* CDockManager::addDockWidget(DockWidgetArea area, return AreaOfAddedDockWidget; } +//============================================================================ +CDockAreaWidget* CDockManager::addDockWidgetToContainer(DockWidgetArea area, + CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget) +{ + d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget); + auto AreaOfAddedDockWidget = DockContainerWidget->addDockWidget(area, Dockwidget); + Q_EMIT dockWidgetAdded(Dockwidget); + return AreaOfAddedDockWidget; +} + //============================================================================ CDockAreaWidget* CDockManager::addDockWidgetTab(DockWidgetArea area, diff --git a/src/DockManager.h b/src/DockManager.h index 46bcb14..7747d23 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -283,6 +283,15 @@ public: CDockAreaWidget* addDockWidget(DockWidgetArea area, CDockWidget* Dockwidget, CDockAreaWidget* DockAreaWidget = nullptr); + /** + * Adds dockwidget into the given container. + * This allows you to place the dock widget into a container, even if that + * container does not yet contain a DockAreaWidget. + * \return Returns the dock area widget that contains the new DockWidget + */ + CDockAreaWidget* addDockWidgetToContainer(DockWidgetArea area, CDockWidget* Dockwidget, + CDockContainerWidget* DockContainerWidget); + /** * This function will add the given Dockwidget to the given dock area as * a new tab.