Skip to content

Commit 7cdf84f

Browse files
committed
Fixed: the focusable CDockWidget would lose focus when another QWindow containing a CDockManager that contains a focusable CDockWidget gains focus
1 parent 90e5add commit 7cdf84f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/DockFocusController.cpp

100644100755
+8-5
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ void CDockFocusController::onFocusWindowChanged(QWindow *focusWindow)
269269
return;
270270
}
271271

272-
d->updateDockWidgetFocus(DockWidget);
272+
if(DockWidget->dockManager() == d->DockManager)
273+
d->updateDockWidgetFocus(DockWidget);
273274
}
274275

275276

@@ -307,18 +308,19 @@ void CDockFocusController::onApplicationFocusChanged(QWidget* focusedOld, QWidge
307308
if (!DockWidget || DockWidget->tabWidget()->isHidden())
308309
{
309310
return;
310-
}
311+
}
311312
#endif
312313

313-
d->updateDockWidgetFocus(DockWidget);
314+
if(DockWidget->dockManager() == d->DockManager)
315+
d->updateDockWidgetFocus(DockWidget);
314316
}
315317

316318

317319
//===========================================================================
318320
void CDockFocusController::setDockWidgetTabFocused(CDockWidgetTab* Tab)
319321
{
320322
auto DockWidget = Tab->dockWidget();
321-
if (DockWidget)
323+
if (DockWidget && DockWidget->dockManager() == d->DockManager)
322324
{
323325
d->updateDockWidgetFocus(DockWidget);
324326
}
@@ -336,7 +338,8 @@ void CDockFocusController::clearDockWidgetFocus(CDockWidget* dockWidget)
336338
//===========================================================================
337339
void CDockFocusController::setDockWidgetFocused(CDockWidget* focusedNow)
338340
{
339-
d->updateDockWidgetFocus(focusedNow);
341+
if(focusedNow->dockManager() == d->DockManager)
342+
d->updateDockWidgetFocus(focusedNow);
340343
}
341344

342345

0 commit comments

Comments
 (0)