aboutsummaryrefslogtreecommitdiffstats
path: root/src/threadlistview.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-10 08:46:31 +0200
committerDanilo M. <danix@danix.xyz>2026-08-10 08:46:31 +0200
commit320189af0baa392bff7ed89fe17ac5d06455454d (patch)
tree20246c1aaa74c37178958a12b34aa2298333ff47 /src/threadlistview.h
parentecd363cd439442029229f45aa6db7d760cc41e1a (diff)
downloadqtmaildir-320189af0baa392bff7ed89fe17ac5d06455454d.tar.gz
qtmaildir-320189af0baa392bff7ed89fe17ac5d06455454d.zip
refactor(view): stop the view painting, and hit-test the reply count
ThreadListView::paintEvent and its band arithmetic are deleted. The view existed to paint a strip across five columns; with one column and one delegate painting the whole card there is nothing to span, and the two faults that arithmetic kept producing go with it: a deleted row cut in half, and every other row showing a bare stripe. What survives is the expander hit-test, because a delegate gets no click of its own without an editor. It now asks CardDelegate for the rect rather than recomputing it, so the drawn target and the clickable one cannot drift. The siblingAtColumn(0) dance is gone: with one column, the index already is column 0. Item 51 closes here rather than separately. A card is exactly viewport width, so the view has no horizontal scroll range for a click to scroll into, and the test asserts that directly. Two rendering tests had to change how they measure, not merely which index they name. The indent test asserted on visualRect, which now reports the SAME rect for a thread and its reply by design, since setIndentation(0) leaves the indent to CardLayout: it reads contentLeft off the layout instead. And the expander test reported zero ink over a card the delegate paints 2183 pixels into, because viewport()->render() returned a blank image, exactly as CLAUDE.md warns; it now paints the delegate into an image directly and carries a guard proving the probe can see ink before it reports finding none. Both were mutation-checked. Two tests are deleted rather than ported. Both existed to prove the row-wide strip spanned columns a delegate could not reach, which is a property of code that no longer exists.
Diffstat (limited to 'src/threadlistview.h')
-rw-r--r--src/threadlistview.h52
1 files changed, 16 insertions, 36 deletions
diff --git a/src/threadlistview.h b/src/threadlistview.h
index 0ebe3ea..3215153 100644
--- a/src/threadlistview.h
+++ b/src/threadlistview.h
@@ -20,34 +20,19 @@
#include <QTreeView>
-/// The thread list, with a row-wide strip of tag chips under each row's cells.
+/// The thread list.
///
-/// The strip is painted by the VIEW rather than by a delegate, and that is the
-/// whole reason this class exists. A delegate is handed one cell's rectangle
-/// and cannot paint outside its column, so pills drawn from the subject
-/// column's delegate stop at that column's edge, losing the last tags of a
-/// well-tagged thread, and start at that column's left edge, which puts them
-/// under the subject instead of under the row. Painting after the cells lets
-/// the strip run the full width, which is what the layout asks for:
+/// It exists for ONE reason now: the expander is drawn by CardDelegate, and a
+/// delegate gets no click of its own without an editor, so the view has to own
+/// the hit-test. Everything else it used to do is gone.
///
-/// [ date ][ from ][ subject ...................... ]
-/// [ pill ][ pill ][ pill ]
-///
-/// The cells confine themselves to the upper band so the lower one is free;
-/// SubjectDelegate::kRowPadding and rowHeightFor() are the shared measurements
-/// that keep the two halves agreeing.
-///
-/// A QTreeView rather than a QTableView since item 20: a thread's replies are
-/// child rows, and a table can neither indent nor expand. The strip survived
-/// the port because every geometry call it needs (visualRect,
-/// columnViewportPosition, indexAt, indexBelow) exists on both. What did NOT
-/// survive is anything keyed on a row NUMBER: a tree numbers rows per parent,
-/// so row 0 exists once per expanded thread and a flat 0..N walk paints the
-/// first thread's strip over every one of them. The walk below goes by index.
-///
-/// The strip is painted for THREAD rows only. It carries the thread's tags, so
-/// one under each reply would stripe the list and repeat identical tags down
-/// the whole expansion.
+/// Until item 53 this class also painted a row-wide strip of tag chips after
+/// the cells, because a delegate cannot paint outside its column and the strip
+/// spanned all five. With one column and one delegate painting the whole card,
+/// that reason is gone and so is the paintEvent, along with the two faults it
+/// kept producing: a deleted row cut in half, and every other row showing a
+/// bare stripe, both from the view having to re-honour alternating colours,
+/// the selection and BackgroundRole across cells it did not own.
class ThreadListView : public QTreeView
{
Q_OBJECT
@@ -55,16 +40,11 @@ public:
using QTreeView::QTreeView;
protected:
- void paintEvent(QPaintEvent *event) override;
-
- /// Toggles a thread when its expander glyph is clicked.
+ /// Toggles a thread when its reply count is clicked.
///
- /// The view owns this because the glyph is drawn by SubjectDelegate and a
- /// delegate gets no click of its own without an editor. Being VISIBLE and
- /// being CLICKABLE are separate properties: setRootIsDecorated(false),
- /// needed to stop the style drawing its own indicator underneath ours, also
- /// removed the style's hit area, so the expander painted correctly and did
- /// nothing at all.
+ /// Being VISIBLE and being CLICKABLE are separate properties:
+ /// setRootIsDecorated(false), needed to stop the style drawing its own
+ /// indicator underneath, also removed the style's hit area, so an expander
+ /// once painted correctly and did nothing at all.
void mousePressEvent(QMouseEvent *event) override;
-
};