From 060313c11f6841354c8247c4e6f493d4f90d3eca Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Thu, 15 Sep 2022 13:04:49 +0800 Subject: [PATCH] clear dock widget focus on repin --- src/DockContainerWidget.cpp | 2 ++ src/DockFocusController.cpp | 8 ++++++++ src/DockFocusController.h | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index 1f99d28..d984834 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -53,6 +53,7 @@ #include "DockWidgetTab.h" #include "DockWidgetSideTab.h" #include "DockAreaTitleBar.h" +#include "DockFocusController.h" #include #include @@ -1508,6 +1509,7 @@ COverlayDockContainer* CDockContainerWidget::createAndInitializeDockWidgetOverla const auto dockContainer = new COverlayDockContainer(DockWidget, area, this); dockContainer->hide(); + d->DockManager->dockFocusController()->clearDockWidgetFocus(DockWidget); return dockContainer; } diff --git a/src/DockFocusController.cpp b/src/DockFocusController.cpp index d467bdb..4310f51 100644 --- a/src/DockFocusController.cpp +++ b/src/DockFocusController.cpp @@ -320,6 +320,14 @@ void CDockFocusController::setDockWidgetTabFocused(CDockWidgetTab* Tab) } +//=========================================================================== +void CDockFocusController::clearDockWidgetFocus(CDockWidget* dockWidget) +{ + dockWidget->clearFocus(); + updateDockWidgetFocusStyle(dockWidget, false); +} + + //=========================================================================== void CDockFocusController::setDockWidgetFocused(CDockWidget* focusedNow) { diff --git a/src/DockFocusController.h b/src/DockFocusController.h index b080f3b..06ec049 100644 --- a/src/DockFocusController.h +++ b/src/DockFocusController.h @@ -75,6 +75,11 @@ public: */ void setDockWidgetTabFocused(CDockWidgetTab* Tab); + /* + * Request clear focus for a dock widget + */ + void clearDockWidgetFocus(CDockWidget* dockWidget); + public Q_SLOTS: /** * Request a focus change to the given dock widget