Skip to content

restoreState doesn't restore which split area was current #852

Description

@borco

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:

  1. Split one dock into two side-by-side areas (A and B).
  2. Click a tab in area B so it's the current area.
  3. Call saveState().
  4. Call restoreState() with those bytes (or restart the app and reload the saved bytes).
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions