1
0
mirror of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git synced 2025-03-15 02:29:52 +08:00

Fixed #711 - Focus loss when closing other dock widgets

This commit is contained in:
Uwe Kindler 2025-03-06 14:59:36 +01:00
parent 782589523e
commit e836b154eb
3 changed files with 16 additions and 3 deletions

View File

@ -423,6 +423,13 @@ CDockWidget* CDockFocusController::focusedDockWidget() const
}
//==========================================================================
CDockAreaWidget* CDockFocusController::focusedDockArea() const
{
return d->FocusedArea.data();
}
//==========================================================================
void CDockFocusController::setDockWidgetTabPressed(bool Value)
{

View File

@ -69,6 +69,12 @@ public:
*/
CDockWidget* focusedDockWidget() const;
/**
* Returns the dock area that contains the focusedDockWidget() or nullptr if
* the focused dock widget is not in this area.
*/
CDockAreaWidget* focusedDockArea() const;
/**
* Request focus highlighting for the given dock widget assigned to the tab
* given in Tab parameter

View File

@ -599,9 +599,9 @@ void CDockWidgetTab::setActiveTab(bool active)
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState())
{
bool UpdateFocusStyle = false;
if (active && !hasFocus())
{
//setFocus(Qt::OtherFocusReason);
// Update the focus only, if this the dock area of this tab is the focused dock area
if (active && !hasFocus() && (d->focusController()->focusedDockArea() == this->dockAreaWidget()))
{
d->focusController()->setDockWidgetTabFocused(this);
UpdateFocusStyle = true;
}