diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index c8ca3bb..e901808 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -262,6 +262,15 @@ void CDockWidget::setWidget(QWidget* widget, eInsertMode InsertMode) } +//============================================================================ +void CDockWidget::releaseWidget() +{ + d->ScrollArea->takeWidget(); + d->Layout->removeWidget(d->Widget); + d->Widget->setParent(nullptr); +} + + //============================================================================ QWidget* CDockWidget::widget() const { diff --git a/src/DockWidget.h b/src/DockWidget.h index e083137..3decfc6 100644 --- a/src/DockWidget.h +++ b/src/DockWidget.h @@ -238,6 +238,11 @@ public: */ void setWidget(QWidget* widget, eInsertMode InsertMode = AutoScrollArea); + /** + * Remove the widget from the dock and give ownership back to the caller + */ + void releaseWidget(); + /** * Returns the widget for the dock widget. This function returns zero if * the widget has not been set.