fixed some bugs

This commit is contained in:
2026-08-15 02:11:03 +02:00
parent 9cf510e93b
commit 9e73c1338f
9 changed files with 169 additions and 22 deletions
+37 -1
View File
@@ -50,18 +50,54 @@ BarPill {
}
}
// Declared with room for its own lean, so the slash sits inside the box
// the Row gave it instead of hanging several px into the date column.
Skew {
anchors.verticalCenter: parent.verticalCenter
width: 2
width: 22 * Theme.skew + 3
height: 22
color: Theme.alpha(Theme.accent, 0.6)
}
// Archivo Black's digits are not all the same width, so a clock sized to
// its own text changed width as the minutes rolled over — 11:11 is
// several px narrower than 08:48 — and shoved the rest of the bar
// around. Reserve the widest possible reading and centre inside it.
TextMetrics {
id: timeMetrics
text: "88:88"
font.family: Theme.fontDisplay
font.pixelSize: Theme.fsTitle
font.weight: Theme.weightDisplay
font.italic: true
font.letterSpacing: 0.5
}
// Archivo Black reserves descender room the time never uses — "12:04"
// is all cap height — so centring the line box left the digits sitting
// above everything beside them. Centre the ink instead.
// `tightBoundingRect` is measured from the baseline, so the ink's top
// inside the line box is `ascent + ink.y`.
readonly property real timeInkOffset: {
const ink = timeMetrics.tightBoundingRect;
if (ink.height <= 0) return 0;
const inkCentre = timeFont.ascent + ink.y + ink.height / 2;
return Math.round(timeMetrics.boundingRect.height / 2 - inkCentre);
}
FontMetrics {
id: timeFont
font: timeMetrics.font
}
SplitText {
id: timeText
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: layout.timeInkOffset
width: timeMetrics.advanceWidth
text: Qt.formatDateTime(clock.date, "HH:mm")
pixelSize: Theme.fsTitle
horizontalAlignment: Text.AlignHCenter
split: 1.4
}