diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-10 08:58:48 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-10 08:58:48 +0200 |
| commit | 8767e8d33f5065ff57d7abd5bc916dbb13ada2d5 (patch) | |
| tree | fff56f2a44b8d978ad3d4793fa951e086c92e220 /src/cardlayout.cpp | |
| parent | 1a96ce7d2a2ba5575502db85bce8ed0efe799665 (diff) | |
| download | qtmaildir-8767e8d33f5065ff57d7abd5bc916dbb13ada2d5.tar.gz qtmaildir-8767e8d33f5065ff57d7abd5bc916dbb13ada2d5.zip | |
fix(view): stop clipping the date, and make the accent bar visible
Both found by rendering real cards to an image and looking at them, not by any
assertion. The suite was green through both.
The date lost the leading digit of its year on every UNREAD card. The layout
reserves the date's width from the font it is handed, which is the view's
regular font, while the delegate paints with the bold one the model supplies for
unread: 154px reserved against 170px needed. CardLayout now measures the date
bold whatever font it is given, so the reserved width cannot be narrower than
what is drawn. A few pixels are wasted on a read card, which is the cheap side of
the trade.
The accent bar was painted correctly and was invisible. Blending the account
colour 0.35 toward the palette's Base, as the plan specified, is a fraction OF
THE ACCOUNT COLOUR, so on a dark theme it produced (0.18, 0.22, 0.26) against a
Base of (0.169, 0.169, 0.169): the background. The blend is dropped entirely.
An account colour is already chosen to be a chip's fill carrying legible text,
so it is muted to begin with, and nothing is drawn on the bar that needs that
contrast. The spine keeps a blend, at 0.55, because it runs the full height of
every reply in an expansion and is a different problem from a 3px edge marker.
The bar is still faint at 3px on a dark theme, since the account colours are
chosen as chip fills. Whether kAccentWidth needs raising cannot be settled
without the user's own accounts, screen and theme; that is Task 10's open
question and it is left open.
Diffstat (limited to 'src/cardlayout.cpp')
| -rw-r--r-- | src/cardlayout.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cardlayout.cpp b/src/cardlayout.cpp index 8d952b2..1a79e3b 100644 --- a/src/cardlayout.cpp +++ b/src/cardlayout.cpp @@ -87,7 +87,16 @@ CardLayout CardLayout::compute(const Input &input, const QRect &rect, // The date is measured first and the sender gets what is left, so a long // sender is elided rather than painting over the date. - const int dateWidth = metrics.horizontalAdvance( + // + // Measured BOLD whatever font this is handed. An unread card draws bold and + // the delegate computes its layout from the view's regular font, so a rect + // sized regular clips a bold date: 154px reserved against 170px needed, one + // digit of the year gone from every unread card. Reserving the wider of the + // two costs a few pixels on a read card and cannot disagree with what is + // painted. + QFont dateFont = font; + dateFont.setBold(true); + const int dateWidth = QFontMetrics(dateFont).horizontalAdvance( QStringLiteral("8888-88-88 88:88")); out.dateRect = QRect(right - dateWidth, lineOneTop, dateWidth, metrics.height()); |
