diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 2394d85..37a2cdc 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -879,14 +879,29 @@ CIconProvider& CDockManager::iconProvider() //=========================================================================== -void CDockManager::onFocusObjectChanged(QObject *focusObject) +void CDockManager::onFocusObjectChanged(QObject *focusObject) { auto FocusWidget = qobject_cast(focusObject); if (!FocusWidget) { return; } - auto DockWidget = internal::findParent(FocusWidget); + + CDockWidget* DockWidget = nullptr; + + std::cout << "CDockManager::onFocusObjectChanged " << focusObject->objectName().toStdString() + << " meta: " << focusObject->metaObject()->className() << std::endl; + + auto DockWidgetTab = qobject_cast(focusObject); + if (DockWidgetTab) + { + DockWidget = DockWidgetTab->dockWidget(); + } + else + { + DockWidget = internal::findParent(FocusWidget); + } + if (!DockWidget) { return; diff --git a/src/DockWidgetTab.cpp b/src/DockWidgetTab.cpp index d290104..7597d05 100644 --- a/src/DockWidgetTab.cpp +++ b/src/DockWidgetTab.cpp @@ -285,6 +285,7 @@ CDockWidgetTab::CDockWidgetTab(CDockWidget* DockWidget, QWidget *parent) : setAttribute(Qt::WA_NoMousePropagation, true); d->DockWidget = DockWidget; d->createLayout(); + setFocusPolicy(Qt::ClickFocus); } //============================================================================