Improved setting of CDockWidgetTab focus

This commit is contained in:
Uwe Kindler 2020-05-11 16:29:58 +02:00
parent 835a20f03f
commit f54869fbf7
2 changed files with 18 additions and 2 deletions

View File

@ -886,7 +886,22 @@ void CDockManager::onFocusObjectChanged(QObject *focusObject)
{
return;
}
auto DockWidget = internal::findParent<CDockWidget*>(FocusWidget);
CDockWidget* DockWidget = nullptr;
std::cout << "CDockManager::onFocusObjectChanged " << focusObject->objectName().toStdString()
<< " meta: " << focusObject->metaObject()->className() << std::endl;
auto DockWidgetTab = qobject_cast<CDockWidgetTab*>(focusObject);
if (DockWidgetTab)
{
DockWidget = DockWidgetTab->dockWidget();
}
else
{
DockWidget = internal::findParent<CDockWidget*>(FocusWidget);
}
if (!DockWidget)
{
return;

View File

@ -285,6 +285,7 @@ CDockWidgetTab::CDockWidgetTab(CDockWidget* DockWidget, QWidget *parent) :
setAttribute(Qt::WA_NoMousePropagation, true);
d->DockWidget = DockWidget;
d->createLayout();
setFocusPolicy(Qt::ClickFocus);
}
//============================================================================