CDockManager.saveState()/restoreState() round-trips the layout (splits, tabs, sizes) correctly, but only records the current tab within each area -- never which of several split areas held focus. After a restore, whichever area was populated first is always current, regardless of which one was actually focused when saveState() was called.
Repro:
- Split one dock into two side-by-side areas (A and B).
- Click a tab in area B so it's the current area.
- Call
saveState().
- Call
restoreState() with those bytes (or restart the app and reload the saved bytes).
- Area A is current again, not B -- the real selection is silently lost.
We work around it by persisting the current dock's objectName() separately from the state blob, and re-selecting it via findDockWidget() after restoreState() returns. Reference implementation (Python/PySide6): https://github.com/borco/rehuco/blob/11a005a/packages/borco-pyside/src/borco_pyside/qtads/qtads_focus_tracker.py#L129-L154
CDockManager.saveState()/restoreState()round-trips the layout (splits, tabs, sizes) correctly, but only records the current tab within each area -- never which of several split areas held focus. After a restore, whichever area was populated first is always current, regardless of which one was actually focused whensaveState()was called.Repro:
saveState().restoreState()with those bytes (or restart the app and reload the saved bytes).We work around it by persisting the current dock's
objectName()separately from the state blob, and re-selecting it viafindDockWidget()afterrestoreState()returns. Reference implementation (Python/PySide6): https://github.com/borco/rehuco/blob/11a005a/packages/borco-pyside/src/borco_pyside/qtads/qtads_focus_tracker.py#L129-L154