Fixed the return value of dockContainer() function if no dock area is assigned, fixed flagAsUnassigned() function

This commit is contained in:
Uwe Kindler 2018-10-11 14:15:27 +02:00
parent 9fec2bd515
commit 548dfb363a
2 changed files with 14 additions and 6 deletions

View File

@ -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());
}

View File

@ -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);
}