Rendering
app.ui.qt.widgets.preview.layer_bbox.renderingRendering primitives for drawing active bbox visuals.
This module contains paint-only helpers and does not mutate widget state.
See Also
BBoxViewModel— provides box geometry and styleget_handle_points_from_rect— computes resize-handle positions
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:
|
displayed_video_height
|
Current fitted/zoomed video height in widget pixels.
TYPE:
|
| 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:
|
rect
|
Projected box geometry in widget pixels.
TYPE:
|
color
|
Annotation color shared with the table swatch.
TYPE:
|
border_width
|
Canvas-scaled outline width.
TYPE:
|
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:
|
rect
|
Projected box geometry in widget pixels.
TYPE:
|
color
|
Annotation color used for the caption's leading stripe.
TYPE:
|
caption
|
Display ID, label, and confidence; long text is elided.
TYPE:
|
viewport
|
Visible canvas used to bound caption size and placement.
TYPE:
|
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:
|
rect
|
Bounding-box rectangle in widget coordinates.
TYPE:
|
border_width
|
Width of the outline pen in pixels.
TYPE:
|
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:
|
rect
|
Bounding-box rectangle in widget coordinates.
TYPE:
|
border_width
|
Width of the outline pen in pixels.
TYPE:
|