From b3e7421d4a55ce85124db2e2ae712040cc758f0a Mon Sep 17 00:00:00 2001 From: wingsummer <1326224942@qq.com> Date: Mon, 16 Sep 2024 17:21:03 +0800 Subject: [PATCH] Fixed: the focusable CDockWidget would lose focus when another QWindow containing a CDockManager that contains a focusable CDockWidget gains focus --- src/DockFocusController.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) mode change 100644 => 100755 src/DockFocusController.cpp diff --git a/src/DockFocusController.cpp b/src/DockFocusController.cpp old mode 100644 new mode 100755 index 27acc4a..19a94f8 --- a/src/DockFocusController.cpp +++ b/src/DockFocusController.cpp @@ -260,7 +260,8 @@ void CDockFocusController::onFocusWindowChanged(QWindow *focusWindow) return; } - d->updateDockWidgetFocus(DockWidget); + if(DockWidget->dockManager() == d->DockManager) + d->updateDockWidgetFocus(DockWidget); } @@ -298,10 +299,11 @@ void CDockFocusController::onApplicationFocusChanged(QWidget* focusedOld, QWidge if (!DockWidget || DockWidget->tabWidget()->isHidden()) { return; - } + } #endif - d->updateDockWidgetFocus(DockWidget); + if(DockWidget->dockManager() == d->DockManager) + d->updateDockWidgetFocus(DockWidget); } @@ -309,7 +311,7 @@ void CDockFocusController::onApplicationFocusChanged(QWidget* focusedOld, QWidge void CDockFocusController::setDockWidgetTabFocused(CDockWidgetTab* Tab) { auto DockWidget = Tab->dockWidget(); - if (DockWidget) + if (DockWidget && DockWidget->dockManager() == d->DockManager) { d->updateDockWidgetFocus(DockWidget); } @@ -327,7 +329,8 @@ void CDockFocusController::clearDockWidgetFocus(CDockWidget* dockWidget) //=========================================================================== void CDockFocusController::setDockWidgetFocused(CDockWidget* focusedNow) { - d->updateDockWidgetFocus(focusedNow); + if(focusedNow->dockManager() == d->DockManager) + d->updateDockWidgetFocus(focusedNow); }