CategoryDelegate#
- class omni.kit.browser.core.CategoryDelegate(tree_mode: bool = False)#
Bases:
AbstractItemDelegateDelegate to represent category item. :param teee_mode: Show categories in tree mode. Default flat mode (no branches)
Methods
__init__(self)Constructs AbstractItemDelegate.
build_branch(model, item[, column_id, ...])Creates a branch widget that toggles subtree display.
build_widget(model, item[, index, level, ...])Creates a widget for a category item in either tree or list view.
get_count(item)Returns the count value of a category item.
get_label(item)Returns the name label of a category item.
- __init__(
- self: omni.ui._ui.AbstractItemDelegate,
Constructs AbstractItemDelegate.
- `kwargsdict`
See below
### Keyword Arguments:
- build_branch(
- model: AbstractItemModel,
- item: CategoryItem,
- column_id: int = 0,
- level: int = 0,
- expanded: bool = False,
Creates a branch widget that toggles subtree display. In tree mode, if the item has children, displays an indented +/- sign based on expansion state. If not in tree mode or no children, no branch is created.
- Parameters:
model (ui.AbstractItemModel) – Category data model.
item (CategoryItem) – Category item.
column_id (int) – Ignored parameter.
level (int) – Ignored parameter for tree indentation spacing.
expanded (bool) – Determines branch sign; True shows ‘-’ and False shows ‘+’.
- build_widget(
- model: AbstractItemModel,
- item: CategoryItem,
- index: int = 0,
- level: int = 0,
- expanded: bool = False,
Creates a widget for a category item in either tree or list view. In tree mode, if the item has children, a branch label is displayed; otherwise, a widget with spacer, label, and count is constructed.
- Parameters:
model (ui.AbstractItemModel) – Category data model.
item (CategoryItem) – Category item.
index (int) – Ignored parameter.
level (int) – Ignored parameter for tree indentation spacing.
expanded (bool) – Ignored parameter for expansion state.
- get_count(
- item: CategoryItem,
Returns the count value of a category item.
- Parameters:
item (CategoryItem) – Category item object.
- Returns:
Count of the category item.
- Return type:
str
- get_label(
- item: CategoryItem,
Returns the name label of a category item.
- Parameters:
item (CategoryItem) – Category item object.
- Returns:
Name of the category item.
- Return type:
str