Remove all dock widget focusable constraint on auto hide button

This commit is contained in:
Syarif Fakhri 2022-10-19 17:30:08 +08:00
parent 7319c52d4d
commit 7ed3f8b2d1

View File

@ -315,11 +315,6 @@ struct DockAreaWidgetPrivate
*/
void updateTitleBarButtonVisibility(bool isTopLevel);
/**
* Convenience function to know if all dock widgets are focusable
*/
bool allDockWidgetsFocusable() const;
/**
* Scans all contained dock widgets for the max. minimum size hint
*/
@ -387,7 +382,7 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel)
if (IsTopLevel)
{
TitleBar->button(TitleBarButtonClose)->setVisible(!container->isFloating());
TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating() && allDockWidgetsFocusable());
TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating());
// Undock and tabs should never show when auto hidden
TitleBar->button(TitleBarButtonUndock)->setVisible(!container->isFloating() && !_this->isAutoHide());
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isAutoHide());
@ -395,25 +390,12 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel)
else
{
TitleBar->button(TitleBarButtonClose)->setVisible(true);
TitleBar->button(TitleBarButtonAutoHide)->setVisible(allDockWidgetsFocusable());
TitleBar->button(TitleBarButtonAutoHide)->setVisible(true);
TitleBar->button(TitleBarButtonUndock)->setVisible(!_this->isAutoHide());
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isAutoHide());
}
}
bool DockAreaWidgetPrivate::allDockWidgetsFocusable() const
{
for (const auto &dockWidget : _this->dockWidgets())
{
if (!dockWidget->features().testFlag(CDockWidget::DockWidgetFocusable))
{
return false;
}
}
return true;
}
//============================================================================
CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget* parent) :