From cc345b38d81971dd425f5c5fd11a67fda7036ab3 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sun, 13 Sep 2026 18:35:09 -0600 Subject: [PATCH] fix(qt): measure the compact album title outside the Text to end a width binding loop The compact heading sized its title with the Text's own implicitWidth while eliding it; an elided Text recomputes its implicit size after laying out at the bound width, so Qt reported a binding loop on `width` on every album open (measured in a 30-minute session log). A TextMetrics with the same font gives the natural width without feeding the loop. cc --- crates/qbz-qt/qml/views/AlbumView.qml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/qbz-qt/qml/views/AlbumView.qml b/crates/qbz-qt/qml/views/AlbumView.qml index ad32e8433..face85dee 100644 --- a/crates/qbz-qt/qml/views/AlbumView.qml +++ b/crates/qbz-qt/qml/views/AlbumView.qml @@ -1001,11 +1001,22 @@ Rectangle { anchors.rightMargin: 10 anchors.verticalCenter: parent.verticalCenter spacing: 0 + // The title's natural width, measured OUTSIDE the + // Text: an elided Text recomputes its implicit size + // after laying out at the bound width, so a `width` + // that reads its own `implicitWidth` is a binding + // loop (Qt reported it on every album open). + TextMetrics { + id: compactTitleMetrics + font.pixelSize: theme.fontSection + font.weight: theme.weightBold + text: albumHeader.title || "" + } Text { id: compactAlbumTitle width: (albumHeader.artist || "") === "" ? compactHeading.width - : Math.min(implicitWidth, + : Math.min(Math.ceil(compactTitleMetrics.advanceWidth), Math.max(80, compactHeading.width * 0.62)) text: albumHeader.title || "" color: root.hdrStrong