Menu
app.ui.qt.widgets.preview.layer_bbox.menuContext menu builders for AnnotationOverlayWidget.
Why this module exists:
- Keeps UI label text near its emitted backend action string.
- Centralizes QAction->action-name mapping to avoid long if/elif chains.
- Preserves placeholder selection entries as explicit no-op actions.
See Also
AnnotationContextActions— defines the action identifiersAnnotationOverlayWidget— displays the generated menus
Layer: Presentation. Context: Contains concrete Qt presentation components and supporting utilities.
build_no_hit_action_map(menu: QMenu) -> dict[QAction, str]
Build context menu actions used when right-clicking empty canvas space.
| PARAMETER | DESCRIPTION |
|---|---|
menu
|
Menu to populate with empty-canvas actions.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[QAction, str]
|
Mapping from each created action to its |
build_hit_action_map(menu: QMenu, tracker_actions_enabled: bool) -> dict[QAction, str]
Build context menu actions used when right-clicking over an existing bbox.
| PARAMETER | DESCRIPTION |
|---|---|
menu
|
Menu to populate with actions for an existing box.
TYPE:
|
tracker_actions_enabled
|
Whether to include delete-next/previous-occurrence actions.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[QAction, str]
|
Mapping from each created action to its |
resolve_selected_action(chosen: QAction | None, action_names: dict[QAction, str]) -> str | None
Resolve the selected QAction into a context action string payload.
| PARAMETER | DESCRIPTION |
|---|---|
chosen
|
Action selected by the user, or
TYPE:
|
action_names
|
Mapping produced by one of the context-menu builders.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str | None
|
Mapped action identifier, or |