Skip to content

Rendering

app.ui.qt.widgets.preview.layer_bbox.rendering

View source code

Rendering primitives for drawing active bbox visuals.

This module contains paint-only helpers and does not mutate widget state.

See Also

Layer: Presentation. Context: Contains concrete Qt presentation components and supporting utilities.

scale_bbox_border_width(border_width: int, displayed_video_height: int) -> int

Scale the configured outline against the displayed video canvas.

PARAMETER DESCRIPTION
border_width

Configured reference width at a 480-pixel video height.

TYPE: int

displayed_video_height

Current fitted/zoomed video height in widget pixels.

TYPE: int

RETURNS DESCRIPTION
int

Visible pen width clamped to the range 1–12 widget pixels.

draw_bbox_outline(painter: QPainter, rect: QRect, color: QColor, border_width: int) -> None

Draw a canvas-space box with a dark halo for contrast over busy footage.

PARAMETER DESCRIPTION
painter

Active painter, whose state is restored before returning.

TYPE: QPainter

rect

Projected box geometry in widget pixels.

TYPE: QRect

color

Annotation color shared with the table swatch.

TYPE: QColor

border_width

Canvas-scaled outline width.

TYPE: int

draw_bbox_caption(painter: QPainter, rect: QRect, color: QColor, caption: str, viewport: QRect) -> None

Draw an opaque caption at UI font size, bounded by the visible canvas.

PARAMETER DESCRIPTION
painter

Active painter, whose state is restored before returning.

TYPE: QPainter

rect

Projected box geometry in widget pixels.

TYPE: QRect

color

Annotation color used for the caption's leading stripe.

TYPE: QColor

caption

Display ID, label, and confidence; long text is elided.

TYPE: str

viewport

Visible canvas used to bound caption size and placement.

TYPE: QRect

Note

Paint captions after all outlines so intersecting boxes do not draw lines through text. Caption font size does not grow during zoom.

draw_active_bbox(painter: QPainter, rect: QRect, border_width: int = 2) -> None

Draw the active bbox with center marker and drag handles.

PARAMETER DESCRIPTION
painter

Active Qt painter to draw with.

TYPE: QPainter

rect

Bounding-box rectangle in widget coordinates.

TYPE: QRect

border_width

Width of the outline pen in pixels.

TYPE: int DEFAULT: 2

draw_selected_bbox(painter: QPainter, rect: QRect, border_width: int = 2) -> None

Draw a selection outline without edit handles.

PARAMETER DESCRIPTION
painter

Active Qt painter to draw with.

TYPE: QPainter

rect

Bounding-box rectangle in widget coordinates.

TYPE: QRect

border_width

Width of the outline pen in pixels.

TYPE: int DEFAULT: 2