Files
qbz/crates/qbz-qt/qml/QbzIcon.qml
T
vicrodh 95df643a25 feat(qbz-qt): phase 3 — Discover > Home with live Qobuz data and artwork
Pure mapping port of home.rs/foryou.rs (quality tiers, award ribbons,
slim grids) into Slint-free rows; discover index + favorites +
release-watch + top artists fetched concurrently (12 sections, ~170
cards live-verified). Artwork via the shared qbz-cache ImageCacheService
(semaphore-16 downloads, file:// rows, native QML decode). HomeView.qml:
tab pill, five rail kinds, shimmer skeleton, error+Retry, offline
placeholder — exact msgids throughout. Sections travel as one JSON
document (cxx-qt-lib cannot nest QVariant containers — documented).

km
2026-07-27 13:36:01 -06:00

29 lines
1.2 KiB
QML

// Tinted SVG icon — the QML equivalent of Slint's QbzIcon (glyphs recolored
// to a theme tint).
//
// POC-NOTE (icon tinting): the QBZ icon set is Feather-style SVGs with a
// hardcoded `stroke="#ffffff"`; Slint recolors at render time, QML's Image
// cannot. A ColorOverlay (Qt5Compat.GraphicalEffects) was tried first and
// renders NOTHING on the offscreen/software path (verified with a probe —
// effects need the GL path), so tinting is done with PRE-BAKED SVG
// variants: assets/icons/<tint>/<name>.svg for tint in {primary,
// secondary, muted, accent, warning} (script-generated from the originals,
// also rewriting fill="currentColor"). `tintName` switches variants
// dynamically (hover = secondary -> primary), served from qrc.
import QtQuick
Image {
id: root
// Icon file name, e.g. "compass" (".svg" appended).
property string name: ""
// One of: "primary" | "secondary" | "muted" | "accent" | "warning" |
// "black" (for glyphs on white discs).
property string tintName: "secondary"
source: "assets/icons/" + tintName + "/" + name + ".svg"
sourceSize: Qt.size(Math.max(1, Math.round(width * 2)), Math.max(1, Math.round(height * 2)))
fillMode: Image.PreserveAspectFit
asynchronous: false
}