Added dockContainer() function to AutoHideSideBar.cpp

This commit is contained in:
Uwe Kindler 2022-12-09 08:50:41 +01:00
parent 302ee59d67
commit 2cd451c53c
3 changed files with 36 additions and 9 deletions

View File

@ -378,11 +378,19 @@ int CAutoHideSideBar::spacing() const
return d->TabsLayout->spacing();
}
//===========================================================================
void CAutoHideSideBar::setSpacing(int Spacing)
{
d->TabsLayout->setSpacing(Spacing);
}
//===========================================================================
CDockContainerWidget* CAutoHideSideBar::dockContainer() const
{
return d->ContainerWidget;
}
} // namespace ads

View File

@ -163,6 +163,11 @@ public:
* Setter for spacing property - sets the spacing
*/
void setSpacing(int Spacing);
/**
* Returns the dock container that hosts this sideBar()
*/
CDockContainerWidget* dockContainer() const;
};
} // namespace ads
//-----------------------------------------------------------------------------

View File

@ -248,17 +248,31 @@ void DockWidgetPrivate::updateParentDockArea()
//============================================================================
void DockWidgetPrivate::closeAutoHideDockWidgetsIfNeeded()
{
if (_this->dockContainer() && _this->dockContainer()->openedDockWidgets().isEmpty() && !_this->dockManager()->isRestoringState())
auto DockContainer = _this->dockContainer();
if (!DockContainer)
{
for (auto autoHideWidget : _this->dockContainer()->autoHideWidgets())
return;
}
if (_this->dockManager()->isRestoringState())
{
if (autoHideWidget->dockWidget() == _this)
return;
}
if (!DockContainer->openedDockWidgets().isEmpty())
{
return;
}
for (auto autoHideWidget : DockContainer->autoHideWidgets())
{
auto DockWidget = autoHideWidget->dockWidget();
if (DockWidget == _this)
{
continue;
}
autoHideWidget->dockWidget()->toggleView(false);
}
DockWidget->toggleView(false);
}
}