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:
@@ -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;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
Reference in New Issue
Block a user