diff --git a/src/DockFocusController.cpp b/src/DockFocusController.cpp index c488288..77e73c1 100644 --- a/src/DockFocusController.cpp +++ b/src/DockFocusController.cpp @@ -381,6 +381,13 @@ void CDockFocusController::onStateRestored() } } + +//========================================================================== +CDockWidget* CDockFocusController::focusedDockWidget() const +{ + return d->FocusedDockWidget.data(); +} + } // namespace ads //--------------------------------------------------------------------------- diff --git a/src/DockFocusController.h b/src/DockFocusController.h index 8adfab5..f6b0af5 100644 --- a/src/DockFocusController.h +++ b/src/DockFocusController.h @@ -77,6 +77,12 @@ public: */ void notifyFloatingWidgetDrop(CFloatingDockContainer* FloatingWidget); + /** + * Returns the dock widget that has focus style in the ui or a nullptr if + * not dock widget is painted focused. + */ + CDockWidget* focusedDockWidget() const; + public slots: /** * Request a focus change to the given dock widget diff --git a/src/DockManager.cpp b/src/DockManager.cpp index d322dfe..e0302b4 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -1042,6 +1042,20 @@ void CDockManager::setDockWidgetFocused(CDockWidget* DockWidget) } +//=========================================================================== +CDockWidget* CDockManager::focusedDockWidget() const +{ + if (!d->FocusController) + { + return nullptr; + } + else + { + return d->FocusController->focusedDockWidget(); + } +} + + } // namespace ads //--------------------------------------------------------------------------- diff --git a/src/DockManager.h b/src/DockManager.h index a987990..8c15209 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -476,6 +476,14 @@ public: bool eventFilter(QObject *obj, QEvent *e) override; #endif + /** + * Returns the dock widget that has focus style in the ui or a nullptr if + * not dock widget is painted focused. + * If the flag FocusHighlighting is disabled, this function always returns + * nullptr. + */ + CDockWidget* focusedDockWidget() const; + public slots: /** * Opens the perspective with the given name.