Improved focus setting when closing a dock area widget
This commit is contained in:
@@ -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<CDockAreaWidget*>(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
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user