From 1d4b52c4986fb23a03a1b25c76ed156320a7f6dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Meyer?= Date: Fri, 21 Feb 2025 11:02:03 +0100 Subject: [PATCH] Always show TitleBar if it contains any explicit actions --- src/DockAreaWidget.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index 662aca8..6d274a2 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -854,10 +854,22 @@ void CDockAreaWidget::updateTitleBarVisibility() bool IsAutoHide = isAutoHide(); if (!CDockManager::testConfigFlag(CDockManager::AlwaysShowTabs)) { - bool Hidden = Container->hasTopLevelDockWidget() && (Container->isFloating() - || CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar)); - Hidden |= (d->Flags.testFlag(HideSingleWidgetTitleBar) && openDockWidgetsCount() == 1); - Hidden &= !IsAutoHide; // Titlebar must always be visible when auto hidden so it can be dragged + bool Hidden = false; + if (!IsAutoHide) // Titlebar must always be visible when auto hidden so it can be dragged + { + if (Container->isFloating() || CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar)) + { + // Always show title bar if it contains title bar actions + if (CDockWidget* TopLevelWidget = Container->topLevelDockWidget()) + Hidden |= TopLevelWidget->titleBarActions().empty(); + } + if (!Hidden && d->Flags.testFlag(HideSingleWidgetTitleBar)) + { + // Always show title bar if it contains title bar actions + auto DockWidgets = openedDockWidgets(); + Hidden |= (DockWidgets.size() == 1) && DockWidgets.front()->titleBarActions().empty(); + } + } d->TitleBar->setVisible(!Hidden); }