mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 15:41:34 +08:00
Improved focus setting when closing a dock area widget
This commit is contained in:
parent
64a2024513
commit
4c75168152
@ -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;
|
||||
|
@ -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
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -87,6 +87,7 @@ private:
|
||||
private slots:
|
||||
void onFocusObjectChanged(QObject *focusObject);
|
||||
void onFocusedDockWidgetClosed();
|
||||
void onFocusedDockAreaViewToggled(bool Open);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user