diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index 5afd9ed..6425be8 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -235,10 +235,10 @@ void MainWindowPrivate::saveState() //============================================================================ void MainWindowPrivate::restoreState() { - /*QSettings Settings("Settings.ini", QSettings::IniFormat); + QSettings Settings("Settings.ini", QSettings::IniFormat); _this->restoreGeometry(Settings.value("mainWindow/Geometry").toByteArray()); _this->restoreState(Settings.value("mainWindow/State").toByteArray()); - DockManager->restoreState(Settings.value("mainWindow/DockingState").toByteArray());*/ + DockManager->restoreState(Settings.value("mainWindow/DockingState").toByteArray()); } diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index 50d61c1..d5b5bc2 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -327,7 +327,14 @@ void CDockWidget::setDockManager(CDockManager* DockManager) //============================================================================ CDockContainerWidget* CDockWidget::dockContainer() const { - return d->DockArea->dockContainer(); + if (d->DockArea) + { + return d->DockArea->dockContainer(); + } + else + { + return 0; + } } @@ -426,9 +433,9 @@ void CDockWidget::toggleView(bool Open) void CDockWidget::toggleViewInternal(bool Open) { CDockContainerWidget* DockContainer = dockContainer(); - CDockWidget* TopLevelDockWidget = nullptr;; + CDockWidget* TopLevelDockWidget = nullptr; - if (Open) + if (Open && DockContainer) { TopLevelDockWidget = DockContainer->topLevelDockWidget(); } @@ -450,7 +457,7 @@ void CDockWidget::toggleViewInternal(bool Open) d->DockArea->toggleDockWidgetView(this, Open); } - if (!Open) + if (!Open && DockContainer) { TopLevelDockWidget = DockContainer->topLevelDockWidget(); } @@ -491,6 +498,7 @@ void CDockWidget::flagAsUnassigned() { d->Closed = true; setParent(d->DockManager); + setVisible(false); setDockArea(nullptr); tabWidget()->setParent(this); }