Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/DockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ struct DockManagerPrivate
bool RestoringState = false;
QVector<CFloatingDockContainer*> UninitializedFloatingWidgets;
CDockFocusController* FocusController = nullptr;
QString RestoredFocusedDockWidget;
CDockWidget* CentralWidget = nullptr;
bool IsLeavingMinimized = false;
Qt::ToolButtonStyle ToolBarStyleDocked = Qt::ToolButtonIconOnly;
Expand Down Expand Up @@ -336,6 +337,12 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
}
}

if (!Testing)
{
// Store the saved focused dock widget name so it can be reapplied after stale focus styling is cleared.
RestoredFocusedDockWidget = s.attributes().value("FocusedDockWidget").toString();
}

int DockContainerCount = 0;
while (s.readNextStartElement())
{
Expand Down Expand Up @@ -871,6 +878,10 @@ QByteArray CDockManager::saveState(int version) const
{
s.writeAttribute("CentralWidget", d->CentralWidget->objectName());
}
if (auto FocusedDockWidget = focusedDockWidget())
{
s.writeAttribute("FocusedDockWidget", FocusedDockWidget->objectName());
}
for (auto Container : d->Containers)
{
Container->saveState(s);
Expand Down Expand Up @@ -916,6 +927,13 @@ bool CDockManager::restoreState(const QByteArray &state, int version)
show();
}
Q_EMIT stateRestored();
if (Result && !d->RestoredFocusedDockWidget.isEmpty())
{
if (auto DockWidget = findDockWidget(d->RestoredFocusedDockWidget))
{
setDockWidgetFocused(DockWidget);
}
}
return Result;
}

Expand Down