pyqt_reactive.widgets.shared.list_item_text_rendering

Structured text rendering and sizing for multiline list items.

Functions

field_matches(path, field_set)

Return whether a segment field path matches any styled field.

Classes

SegmentListPaintSpec(segments, style_key)

Projection for one separated segment-list paint operation.

SegmentListPaintStyle(default_separator[, ...])

Display syntax for a separated segment list.

SegmentListPaintStyleKey(*values)

Named segment-list display styles.

StyledTextPaintRequest(painter, layout, ...)

One structured text paint pass.

StyledTextRenderer()

Paints StyledTextLayout values without string parsing.

StyledTextSizeCalculator()

Calculates size hints for structured and plain list-item text.

TextPaintContext(dirty_fields, ...)

Inputs shared by structured text painting helpers.

pyqt_reactive.widgets.shared.list_item_text_rendering.field_matches(path: str | None, field_set: Set[str]) bool[source]

Return whether a segment field path matches any styled field.

class pyqt_reactive.widgets.shared.list_item_text_rendering.TextPaintContext(dirty_fields: Set[str], sig_diff_fields: Set[str], base_font: QFont, name_color: QColor, preview_color: QColor)[source]

Inputs shared by structured text painting helpers.

dirty_fields: Set[str]
sig_diff_fields: Set[str]
base_font: QFont
name_color: QColor
preview_color: QColor
__init__(dirty_fields: Set[str], sig_diff_fields: Set[str], base_font: QFont, name_color: QColor, preview_color: QColor) None
class pyqt_reactive.widgets.shared.list_item_text_rendering.StyledTextPaintRequest(painter: QPainter, layout: StyledTextLayout, context: TextPaintContext, x_start: int, y_offset: int, line_height: int)[source]

One structured text paint pass.

painter: QPainter
layout: StyledTextLayout
context: TextPaintContext
x_start: int
y_offset: int
line_height: int
__init__(painter: QPainter, layout: StyledTextLayout, context: TextPaintContext, x_start: int, y_offset: int, line_height: int) None
class pyqt_reactive.widgets.shared.list_item_text_rendering.SegmentListPaintStyle(default_separator: str, prefix: str = '', suffix: str = '')[source]

Display syntax for a separated segment list.

default_separator: str
prefix: str = ''
suffix: str = ''
__init__(default_separator: str, prefix: str = '', suffix: str = '') None
class pyqt_reactive.widgets.shared.list_item_text_rendering.SegmentListPaintStyleKey(*values)[source]

Named segment-list display styles.

PARENTHESIZED_INLINE = SegmentListPaintStyle(default_separator=' | ', prefix='  (', suffix=')')
PREVIEW = SegmentListPaintStyle(default_separator=' | ', prefix='', suffix='')
CONFIG = SegmentListPaintStyle(default_separator=', ', prefix='configs=[', suffix=']')
property style: SegmentListPaintStyle
class pyqt_reactive.widgets.shared.list_item_text_rendering.SegmentListPaintSpec(segments: list[Segment], style_key: SegmentListPaintStyleKey)[source]

Projection for one separated segment-list paint operation.

segments: list[Segment]
style_key: SegmentListPaintStyleKey
property style: SegmentListPaintStyle
__init__(segments: list[Segment], style_key: SegmentListPaintStyleKey) None
class pyqt_reactive.widgets.shared.list_item_text_rendering.StyledTextRenderer[source]

Paints StyledTextLayout values without string parsing.

paint_layout(painter: QPainter, layout: StyledTextLayout, context: TextPaintContext, x_start: int, y_offset: int, line_height: int) None[source]

Paint from structured layout.

draw_segment(painter: QPainter, x: int, y: int, segment: Segment, context: TextPaintContext, color: QColor) int[source]

Draw a segment with dirty/sig-diff styling. Returns new x position.

draw_plain(painter: QPainter, x: int, y: int, text: str, font: QFont, color: QColor) int[source]

Draw plain text without styling. Returns new x position.

class pyqt_reactive.widgets.shared.list_item_text_rendering.StyledTextSizeCalculator[source]

Calculates size hints for structured and plain list-item text.

from_layout(layout: StyledTextLayout, font: QFont) QSize[source]
from_text(text: str, font: QFont) QSize[source]