diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index b66fe6cd30..197b7fd2e0 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -1113,14 +1113,13 @@ void CaptureWidget::setState(CaptureToolButton* b) if (b->tool()->isSelectable()) { if (m_activeButton != b) { - QWidget* confW = b->tool()->configurationWidget(); - m_panel->setToolWidget(confW); if (m_activeButton) { m_activeButton->setColor(m_uiColor); } m_activeButton = b; m_activeButton->setColor(m_contrastUiColor); m_panel->setActiveLayer(-1); + m_panel->setToolWidget(b->tool()->configurationWidget()); } else if (m_activeButton) { m_panel->clearToolWidget(); m_activeButton->setColor(m_uiColor); diff --git a/src/widgets/panel/utilitypanel.cpp b/src/widgets/panel/utilitypanel.cpp index 7760e90fe4..df1479f9a4 100644 --- a/src/widgets/panel/utilitypanel.cpp +++ b/src/widgets/panel/utilitypanel.cpp @@ -56,9 +56,9 @@ QWidget* UtilityPanel::toolWidget() const void UtilityPanel::setToolWidget(QWidget* w) { if (m_toolWidget) { - m_toolWidget->close(); - delete m_toolWidget; - m_toolWidget = nullptr; + m_toolWidget->hide(); + m_toolWidget->setParent(this); + m_toolWidget->deleteLater(); } if (w) { m_toolWidget = w;