Fixed centralwidget example to properly close all floating widgets on main window close

This commit is contained in:
Uwe Kindler 2020-11-26 08:07:31 +01:00
parent 899e06be1c
commit 75910e910e
2 changed files with 14 additions and 0 deletions

View File

@ -133,3 +133,14 @@ void CMainWindow::savePerspective()
PerspectiveComboBox->setCurrentText(PerspectiveName); PerspectiveComboBox->setCurrentText(PerspectiveName);
} }
//============================================================================
void CMainWindow::closeEvent(QCloseEvent* event)
{
// Delete dock manager here to delete all floating widgets. This ensures
// that all top level windows of the dock manager are properly closed
DockManager->deleteLater();
QMainWindow::closeEvent(event);
}

View File

@ -21,6 +21,9 @@ public:
CMainWindow(QWidget *parent = nullptr); CMainWindow(QWidget *parent = nullptr);
~CMainWindow(); ~CMainWindow();
protected:
virtual void closeEvent(QCloseEvent* event) override;
private: private:
QAction* SavePerspectiveAction = nullptr; QAction* SavePerspectiveAction = nullptr;
QWidgetAction* PerspectiveListAction = nullptr; QWidgetAction* PerspectiveListAction = nullptr;