Added focusedDockWidget() function to DockManager

This commit is contained in:
Uwe Kindler 2020-09-07 08:17:07 +02:00
parent 044a43d793
commit fdedd7d92a
4 changed files with 35 additions and 0 deletions

View File

@ -381,6 +381,13 @@ void CDockFocusController::onStateRestored()
}
}
//==========================================================================
CDockWidget* CDockFocusController::focusedDockWidget() const
{
return d->FocusedDockWidget.data();
}
} // namespace ads
//---------------------------------------------------------------------------

View File

@ -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

View File

@ -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
//---------------------------------------------------------------------------

View File

@ -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.