Files
qbz/crates/qbz-qt/qml/controls/ViewModeToggle.qml
T
vicrodh b136c9cf5d feat(qt): ambient background port, clip sweep and measurement tooling
Accumulated qt-frontend work from the 2026-08-11/12 sessions (cc),
uncommitted until now: the app-wide dynamic background in both modes
(AmbientField with GPU/Canvas arms, AppShell layering, ambient palette
pipeline), the wave-1 clip/batch sweep across the tree (alpha batches
449 -> 327, reproducible), the rounded-cover and icon-tint arms, and
scripts/qt-batches.sh (batches + presents/s sampler).

The GPU behaviour of these pieces was finalized in the follow-up pulse
commits; see qbz-nix-docs/qt-frontend/2026-08-11-scenegraph-batches/
GPU-COST-INVESTIGATION.md for the full campaign.

km
2026-08-13 13:01:32 -06:00

48 lines
1.4 KiB
QML

// ViewModeToggle — discover/BrowseHeaderTools.slint:149-173, verbatim: the
// 68x34 grid/list pair, radius 6, surface-elevated, CLIPPED so the segments'
// own corners never poke out.
//
// NOT views/local/LocalSegToggle.qml — that one is 60x30 with 26x24 segments
// (LocalLibraryView.slint's own ViewToggle) and reusing it here would ship a
// browse toolbar 8px short of every other control on the row
// (ui-control-alignment-standard: 34px).
//
// `mode` is the caller's state ("grid" | "list"); the toggle only reports the
// change — the host owns persistence, exactly like the Slint two-way binding.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
id: root
property string mode: "grid"
signal setMode(string value)
QbzTheme { id: theme }
width: 68
height: 34
radius: 6
// The well: surface-elevated @ 0.5 under the dynamic background
// (BrowseHeaderTools.slint:155).
color: theme.ambientOn ? theme.surfaceElevatedA50 : theme.surfaceElevated
clip: true
Row {
anchors.centerIn: parent
spacing: 0
QbzToggleButton {
name: "layout-grid"
active: root.mode !== "list"
onClicked: root.setMode("grid")
}
QbzToggleButton {
name: "list"
active: root.mode === "list"
onClicked: root.setMode("list")
}
}
}