Central widget update

Updated the setting of central widget with option to set where the possible old central widget will be placed. Fixed option of "unsetting" central widget by setting it to nullptr.
This commit is contained in:
hulswit
2020-08-21 13:30:59 +02:00
parent 691c9683ce
commit 14c29f695c
8 changed files with 28 additions and 69 deletions

View File

@@ -407,6 +407,7 @@ bool DockManagerPrivate::restoreState(const QByteArray& State, int version)
return false;
}
CentralWidget = nullptr;
// Hide updates of floating widgets from use
hideFloatingWidgets();
markDockWidgetsDirty();
@@ -830,15 +831,25 @@ CDockWidget* CDockManager::centralWidget()
}
//============================================================================
CDockAreaWidget* CDockManager::setCentralWidget(CDockWidget* widget)
CDockAreaWidget* CDockManager::setCentralWidget(CDockWidget* widget, CDockWidget* oldCentralWidget, DockWidgetArea oldCentralWidgetArea)
{
if(d->CentralWidget)
oldCentralWidget = d->CentralWidget;
if(oldCentralWidget)
{
addDockWidget(RightDockWidgetArea, d->CentralWidget);
addDockWidget(oldCentralWidgetArea, oldCentralWidget);
}
d->CentralWidget = widget;
return addDockWidget(CenterDockWidgetArea, widget);
if(widget)
{
widget->setFeature(CDockWidget::DockWidgetClosable, false);
widget->setFeature(CDockWidget::DockWidgetMovable, false);
widget->setFeature(CDockWidget::DockWidgetFloatable, false);
d->CentralWidget = widget;
CDockAreaWidget* CentralArea = addDockWidget(CenterDockWidgetArea, widget);
CentralArea->setDockAreaFlag(CDockAreaWidget::eDockAreaFlag::HideSingleWidgetTitleBar, true);
return CentralArea;
}
return nullptr;
}
//============================================================================