Skip to content

Commit fdedd7d

Browse files
Added focusedDockWidget() function to DockManager
1 parent 044a43d commit fdedd7d

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

src/DockFocusController.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,13 @@ void CDockFocusController::onStateRestored()
381381
}
382382
}
383383

384+
385+
//==========================================================================
386+
CDockWidget* CDockFocusController::focusedDockWidget() const
387+
{
388+
return d->FocusedDockWidget.data();
389+
}
390+
384391
} // namespace ads
385392

386393
//---------------------------------------------------------------------------

src/DockFocusController.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ private slots:
7777
*/
7878
void notifyFloatingWidgetDrop(CFloatingDockContainer* FloatingWidget);
7979

80+
/**
81+
* Returns the dock widget that has focus style in the ui or a nullptr if
82+
* not dock widget is painted focused.
83+
*/
84+
CDockWidget* focusedDockWidget() const;
85+
8086
public slots:
8187
/**
8288
* Request a focus change to the given dock widget

src/DockManager.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,20 @@ void CDockManager::setDockWidgetFocused(CDockWidget* DockWidget)
10421042
}
10431043

10441044

1045+
//===========================================================================
1046+
CDockWidget* CDockManager::focusedDockWidget() const
1047+
{
1048+
if (!d->FocusController)
1049+
{
1050+
return nullptr;
1051+
}
1052+
else
1053+
{
1054+
return d->FocusController->focusedDockWidget();
1055+
}
1056+
}
1057+
1058+
10451059
} // namespace ads
10461060

10471061
//---------------------------------------------------------------------------

src/DockManager.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,14 @@ class ADS_EXPORT CDockManager : public CDockContainerWidget
476476
bool eventFilter(QObject *obj, QEvent *e) override;
477477
#endif
478478

479+
/**
480+
* Returns the dock widget that has focus style in the ui or a nullptr if
481+
* not dock widget is painted focused.
482+
* If the flag FocusHighlighting is disabled, this function always returns
483+
* nullptr.
484+
*/
485+
CDockWidget* focusedDockWidget() const;
486+
479487
public slots:
480488
/**
481489
* Opens the perspective with the given name.

0 commit comments

Comments
 (0)