ComboBoxListModel
- class omni.kit.widget.searchable_combobox.combo_model.ComboBoxListModel(item_list)
Bases:
AbstractItemModel
A model for managing a list of items in a ComboBox.
- Parameters
item_list (list of str) – The list of items to populate the model with.
Methods
__init__
(item_list)Initializes a new ComboBoxListModel with a list of items.
clean
()Cleans up the ComboBoxListModel instance by resetting the global instance variable.
filter_by_text
(filter_name_text)Filters the items in the model based on the given text.
get_drag_mime_data
(item)Gets the MIME data for an item to enable drag-and-drop operations.
get_index_for_item
(item_text)Finds the index of an item in the model by its text representation.
get_item_children
(item)Retrieves all the filtered children of the given item.
get_item_value_model
(item, column_id)Retrieves the value model for a particular item and column.
Returns the number of columns for a given item.
- __init__(item_list)
Initializes a new ComboBoxListModel with a list of items.
- clean()
Cleans up the ComboBoxListModel instance by resetting the global instance variable.
- filter_by_text(filter_name_text: str)
Filters the items in the model based on the given text.
- Parameters
filter_name_text (str) – The text to filter the items by.
- get_drag_mime_data(item)
Gets the MIME data for an item to enable drag-and-drop operations.
- Parameters
item (ComboBoxListItem) – The item for which to get the MIME data.
- Returns
The MIME data as a string.
- Return type
str
- get_index_for_item(item_text: str)
Finds the index of an item in the model by its text representation.
- Parameters
item_text (str) – The text representation of the item to find.
- Returns
The index of the item if found, -1 otherwise.
- Return type
int
- get_item_children(item)
Retrieves all the filtered children of the given item.
- Parameters
item (ui.AbstractItem) – The parent item to get children for.
- Returns
A list of filtered children items.
- Return type
list[ComboBoxListItem]
- get_item_value_model(item, column_id)
Retrieves the value model for a particular item and column.
- Parameters
item (ui.AbstractItem) – The item to get the value model for.
column_id (int) – The column id for the item.
- Returns
The value model of the item.
- Return type
ui.SimpleStringModel
- get_item_value_model_count(item)
Returns the number of columns for a given item.
- Parameters
item (ui.AbstractItem) – The item to query.
- Returns
The number of columns.
- Return type
int