Expand description
N-pane split container with draggable, collapsible dividers.
Splitter arranges N ≥ 2 panes along one axis (per Orientation)
with N − 1 grabbable handles between them — the Qt QSplitter
model. All layout state (per-pane size / min / max / stretch /
collapsed) lives in a shared, cloneable SplitterModel; the app
holds a clone to read, mutate, persist, and import/export, while the
widget renders it and reacts to the model’s version signal.
Strengths carried over from the old two-pane SplitView: anti-jump
drag, keyboard resize, Role::Splitter accessibility, per-pane content
clipping, RTL-correct horizontal layout. New: N panes, per-pane
stretch (container-resize policy), animated collapse with four triggers
(programmatic / double-click / drag-past-min snap / keyboard), a Tier-3
[SplitterStyle], and serializable import/export. Intended as the
building block for a future DockingLayout.
let model = SplitterModel::from_panes(vec![
PaneDescriptor::new().size(220.0).min_size(160.0).stretch(0.0).collapsible(true),
PaneDescriptor::new().stretch(1.0).min_size(320.0),
PaneDescriptor::new().size(280.0).stretch(0.0).collapsible(true),
], Orientation::Horizontal);
Splitter::new(model.clone())
.pane(sidebar).pane(editor).pane(inspector)
.pane_label(0, tr!(sidebar()));Structs§
- Pane
Descriptor - Per-pane configuration passed to
SplitterModel::from_panes/SplitterModel::insert_pane. Public fields +Defaultso it can be built with struct-literal..Default::default()syntax, or via the fluent setters. - Pane
Snapshot - Immutable per-pane view handed to the pure
distributesizing function (the internalsplitter::distributeengine). - Pane
State - Persistable per-pane layout state. Captures the user-controllable
values (size + collapsed); structural config (min/max/stretch/
collapsible) is app-declared and not serialized — Qt
saveStateparity. - Splitter
- An N-pane resizable split container driven by a
SplitterModel. - Splitter
Model - A shared, cloneable handle to a splitter’s layout state.
Clone= share-by-handle (cheapRcbump). - Splitter
State - Full serializable snapshot of a
SplitterModel’s sizes + collapsed flags. Round-trips throughSplitterModel::export_state/import_stateand implementsVersionedso apps persist it throughSettingsFile<SplitterState>+Migrator(TOML).
Constants§
- SPLITTER_
GUTTER_ THICKNESS - Default gutter (handle) thickness in logical px. Resolved into the
model at construction; override with
SplitterModel::set_gutter_thickness. - SPLITTER_
KEYBOARD_ STEP - Default keyboard resize step in logical px (per arrow press).
- SPLITTER_
MIN_ PANE_ SIZE - Default minimum pane size in logical px.
- SPLITTER_
SNAP_ OFFSET - Default drag-past-min snap-to-collapse threshold in logical px.