test(kit): tighten quiet-role alignment probe; document quiet paint tradeoffs
This commit is contained in:
@@ -150,7 +150,8 @@ class InstrumentDelegate(QStyledItemDelegate):
|
||||
if show_affordance:
|
||||
self._paint_hover_chip(painter, rect, t)
|
||||
|
||||
# Content.
|
||||
# Content. QUIET_ROLE diverts TEXT cells to the manual path; icons/checkboxes
|
||||
# are not supported on quiet cells (empty-slot cells carry neither).
|
||||
if kind in (CellKind.NUMERIC, CellKind.IDENTIFIER) or index.data(QUIET_ROLE):
|
||||
# Fix 5: dim manual-path content for disabled cells (spec §5.1: 40%).
|
||||
# Save/restore scopes the opacity change so the edge bar is unaffected.
|
||||
@@ -190,7 +191,7 @@ class InstrumentDelegate(QStyledItemDelegate):
|
||||
# Fix 2: accept QColor as well as QBrush for ForegroundRole.
|
||||
fg = _as_brush(index.data(Qt.ItemDataRole.ForegroundRole))
|
||||
if index.data(QUIET_ROLE):
|
||||
pen = qcolor(t.faint)
|
||||
pen = qcolor(t.faint) # quiet wins over ForegroundRole: de-emphasis is unconditional
|
||||
elif fg is not None:
|
||||
pen = fg.color()
|
||||
else:
|
||||
|
||||
@@ -255,5 +255,6 @@ def test_quiet_role_combines_with_numeric_kind(qtbot, render_cell):
|
||||
delegate.set_column_kind(0, CellKind.NUMERIC)
|
||||
table.item(0, 0).setData(QUIET_ROLE, True)
|
||||
image = render_cell(delegate, table.model().index(0, 0))
|
||||
_left, right = _ink_span(image, current().faint, tol=40)
|
||||
assert right is not None and right > 95 # still right-aligned mono
|
||||
left, right = _ink_span(image, current().faint, tol=40)
|
||||
assert right is not None and right > 95 # hugs the right edge
|
||||
assert left > 60 # nothing drawn at the left
|
||||
|
||||
Reference in New Issue
Block a user