aboutsummaryrefslogtreecommitdiffstats
path: root/src/threadlistmodel.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-07 16:26:22 +0200
committerDanilo M. <danix@danix.xyz>2026-08-07 16:26:22 +0200
commit39cbde74a560407e24b05e171df883421aa2153e (patch)
treea7390b036f57507b17aa4291511ce33d3f297f81 /src/threadlistmodel.h
parentde884b036689b253d10ff48daa3a05cca20ba61d (diff)
downloadqtmaildir-39cbde74a560407e24b05e171df883421aa2153e.tar.gz
qtmaildir-39cbde74a560407e24b05e171df883421aa2153e.zip
feat(ui): show each thread's tags under its row
The thread list was uniform and cramped: every row one line tall, with nothing to say what a thread was about before opening it. Rows are now roughly double height, carrying a strip of tag chips beneath the text, with alternating row colours and a star column for flagged threads beside the existing paperclip. The strip is painted by the VIEW rather than by a delegate, which is why ThreadListView exists. A delegate is handed one cell's rectangle and cannot paint outside its column, so a strip drawn from the subject column stops at that column's edge, losing the last tags of a well-tagged thread, and starts at its left edge, putting the chips under the subject instead of under the row. Tags the row already shows another way are left out: inbox as structure, unread as the dimming, flagged as the star, attachment as the paperclip, and the account as the chip in the subject cell. Sorted, since notmuch's order is not guaranteed stable and a row whose chips reordered between repaints would flicker. Six defects were introduced and fixed on the way here, all of them one consequence: a QTableView paints per cell, and a row-wide strip is not a cell. SubjectDelegate installed view-wide drew the account chip into every column, since AccountLabelRole belongs to the row; it is split into RowStyleDelegate for every column and SubjectDelegate for the subject alone, with a Q_ASSERT guarding that. Row height returned from sizeHint did nothing, because a table takes one height per row. The strip painted from x=0 over the marker columns, via a protected viewportMargins() that returns 0. Measuring the text band and the strip with one font put the pills over the date. Alternating colours and the selection are per-cell too, so the band showed bare viewport background until the view filled it, honouring the model's own BackgroundRole first so a deleted row is not cut in half. And that fill spanned the full width, cutting the centred marker glyphs at their midpoint. Closes item 5. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/threadlistmodel.h')
-rw-r--r--src/threadlistmodel.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/threadlistmodel.h b/src/threadlistmodel.h
index 152730f..461e467 100644
--- a/src/threadlistmodel.h
+++ b/src/threadlistmodel.h
@@ -40,6 +40,11 @@ public:
/// without opening the thread. Icon only and deliberately narrow;
/// it carries no text.
AttachmentColumn = 0,
+
+ /// A star when the thread carries the flagged tag. Beside the
+ /// paperclip and the same shape: icon only, narrow, no text.
+ FlagColumn,
+
DateColumn,
AuthorsColumn,
SubjectColumn,
@@ -62,6 +67,16 @@ public:
/// Every tag on the thread, for the strip under the message pane.
TagsRole,
+
+ /// The tags worth drawing as pills under the subject: every tag except
+ /// the ones the row already shows another way. Sorted, so a row does
+ /// not reshuffle its own pills between repaints.
+ PillTagsRole,
+
+ /// The colours for PillTagsRole, in the same order. Supplied by the
+ /// model because it owns the TagColors instance; a delegate reading
+ /// config itself would be a second source of truth.
+ PillColoursRole,
};
/// Row fill for a thread tagged `deleted`, and for one tagged `spam`.
@@ -72,16 +87,20 @@ public:
/// A paperclip when the system font can draw it, "*" otherwise.
static QString attachmentGlyph();
+ /// The character shown in FlagColumn for a flagged thread.
+ /// A star when the system font can draw it, "*" otherwise.
+ static QString flagGlyph();
+
static QColor deletedColour();
static QColor spamColour();
/// The dimmed text colour a READ thread carries.
///
/// Unread rows are left at the palette's own colour and read ones recede,
- /// rather than unread being emphasised. Bold used to be the only cue and
- /// cannot be relied on: on at least one system it renders identically to
- /// regular, which is a Qt or fontconfig matter this application cannot
- /// reach. Derived from the palette, never hardcoded.
+ /// rather than unread being emphasised. Bold alone used to be the only
+ /// cue, which leaves nothing to see when the desktop font is itself
+ /// configured bold; colour is a second cue that survives that. Derived
+ /// from the palette, never hardcoded.
static QColor readColour();
explicit ThreadListModel(QObject *parent = nullptr);