Skip to content

Commit e836b15

Browse files
Fixed #711 - Focus loss when closing other dock widgets
1 parent 7825895 commit e836b15

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/DockFocusController.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,13 @@ CDockWidget* CDockFocusController::focusedDockWidget() const
423423
}
424424

425425

426+
//==========================================================================
427+
CDockAreaWidget* CDockFocusController::focusedDockArea() const
428+
{
429+
return d->FocusedArea.data();
430+
}
431+
432+
426433
//==========================================================================
427434
void CDockFocusController::setDockWidgetTabPressed(bool Value)
428435
{

src/DockFocusController.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ private Q_SLOTS:
6969
*/
7070
CDockWidget* focusedDockWidget() const;
7171

72+
/**
73+
* Returns the dock area that contains the focusedDockWidget() or nullptr if
74+
* the focused dock widget is not in this area.
75+
*/
76+
CDockAreaWidget* focusedDockArea() const;
77+
7278
/**
7379
* Request focus highlighting for the given dock widget assigned to the tab
7480
* given in Tab parameter

src/DockWidgetTab.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,9 @@ void CDockWidgetTab::setActiveTab(bool active)
599599
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState())
600600
{
601601
bool UpdateFocusStyle = false;
602-
if (active && !hasFocus())
603-
{
604-
//setFocus(Qt::OtherFocusReason);
602+
// Update the focus only, if this the dock area of this tab is the focused dock area
603+
if (active && !hasFocus() && (d->focusController()->focusedDockArea() == this->dockAreaWidget()))
604+
{
605605
d->focusController()->setDockWidgetTabFocused(this);
606606
UpdateFocusStyle = true;
607607
}

0 commit comments

Comments
 (0)