diff --git a/src/DockContainerWidget.h b/src/DockContainerWidget.h index b23e017..c9a764f 100644 --- a/src/DockContainerWidget.h +++ b/src/DockContainerWidget.h @@ -193,7 +193,7 @@ public: bool isInFrontOf(CDockContainerWidget* Other) const; /** - * Returns the dock area at teh given global position or 0 if there is no + * Returns the dock area at the given global position or 0 if there is no * dock area at this position */ CDockAreaWidget* dockAreaAt(const QPoint& GlobalPos) const; diff --git a/src/DockManager.cpp b/src/DockManager.cpp index a172364..711e58a 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -943,6 +943,7 @@ void CDockManager::onFocusObjectChanged(QObject *focusObject) if (d->FocusedArea) { + disconnect(d->FocusedArea, SIGNAL(viewToggled(bool)), this, SLOT(onFocusedDockAreaViewToggled(bool))); d->FocusedArea->setProperty("focused", false); internal::repolishStyle(d->FocusedArea); internal::repolishStyle(d->FocusedArea->titleBar()); @@ -952,8 +953,10 @@ void CDockManager::onFocusObjectChanged(QObject *focusObject) internal::repolishStyle(NewFocusedDockArea); internal::repolishStyle(NewFocusedDockArea->titleBar()); d->FocusedArea = NewFocusedDockArea; + connect(d->FocusedArea, SIGNAL(viewToggled(bool)), this, SLOT(onFocusedDockAreaViewToggled(bool))); } + //=========================================================================== void CDockManager::onFocusedDockWidgetClosed() { @@ -961,6 +964,25 @@ void CDockManager::onFocusedDockWidgetClosed() } +//=========================================================================== +void CDockManager::onFocusedDockAreaViewToggled(bool Open) +{ + CDockAreaWidget* DockArea = qobject_cast(sender()); + if (!DockArea || Open) + { + return; + } + auto Container = DockArea->dockContainer(); + auto OpenedDockAreas = Container->openedDockAreas(); + if (OpenedDockAreas.isEmpty()) + { + return; + } + + OpenedDockAreas[0]->currentDockWidget()->tabWidget()->setFocus(Qt::OtherFocusReason); +} + + } // namespace ads //--------------------------------------------------------------------------- diff --git a/src/DockManager.h b/src/DockManager.h index 14932a7..8999277 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -87,6 +87,7 @@ private: private slots: void onFocusObjectChanged(QObject *focusObject); void onFocusedDockWidgetClosed(); + void onFocusedDockAreaViewToggled(bool Open); protected: /**