From de884b036689b253d10ff48daa3a05cca20ba61d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 7 Aug 2026 12:48:30 +0200 Subject: fix(ui): tell read threads from unread without relying on bold Bold was unread's only cue, and it renders identically to regular on the user's system: confirmed by eye against a bare QTableView holding a plain QStandardItemModel, with no code from this project involved. The fault is in Qt or fontconfig, below this application, and nothing in the model could ever have reached it. Read and unread mail looked exactly alike. The emphasis is inverted instead. Unread rows keep the palette's own text colour and read rows are dimmed toward the background, so the cue rides on Qt::ForegroundRole, which the delegate already honours, and costs no column. It also suits the real ratio, measured at 99 unread against 4220 read: dimming the bulk is calmer than highlighting it. The dim colour is derived from the palette, never hardcoded, per the rule item 12 established. Bold is kept for systems where it works, but nothing depends on it now. That exposed a second defect, visible the moment it shipped. Qt resolves ForegroundRole into the palette and then prefers it over HighlightedText, so a model-supplied colour wins on a SELECTED row too. The dim is blended against the unselected background, so a selected read row painted grey on the selection colour, near unreadable. SubjectDelegate::initStyleOption now reverses that, and the delegate is installed view-wide rather than on the subject column alone, so every column gets the same handling instead of three of them keeping Qt's ordering. The guarding tests state the property rather than the mechanism: strip the font from the model's answer and the two states must still differ. A test asserting only that bold is set passes on a system where bold paints like regular, which is exactly how this survived. The selection test renders two rows identical but for the unread tag, selects both, and requires zero differing pixels. Part of item 5; the density work and the star column remain. Co-Authored-By: Claude Opus 5 --- src/tagchip.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/tagchip.h') diff --git a/src/tagchip.h b/src/tagchip.h index 9bd4e78..f43e3ff 100644 --- a/src/tagchip.h +++ b/src/tagchip.h @@ -59,4 +59,12 @@ public: const QModelIndex &index) const override; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; + +protected: + /// Makes the selection highlight outrank a model-supplied foreground. + /// + /// Qt's own resolution does the opposite, which leaves a dimmed read + /// thread painting grey over the selection colour. + void initStyleOption(QStyleOptionViewItem *option, + const QModelIndex &index) const override; }; -- cgit v1.2.3