EditableDelegate
- class omni.kit.window.extensions.exts_properties_registries.EditableDelegate
Bases:
AbstractItemDelegate
A delegate class that provides an editable interface for registry items.
This delegate is used to create interactive UI elements for each registry item in a TreeView. It supports editing of the item’s name and URL, copying the item’s text with a context menu, and handling user interactions such as double-clicking to edit and confirming edits. It also includes visual cues to distinguish between user-defined and built-in registry items.
Methods
__init__
()Initialize the EditableDelegate with default values and a context menu.
build_header
(column_id)Builds the header for a specified column in the tree view.
build_widget
(model, item, column_id, level, ...)Create a widget per column per item
destroy
()Cleans up the delegate by clearing subscriptions and context menus.
on_double_click
(button, field, label, model, ...)Called when the user double-clicked the item in TreeView
on_end_edit
(text, field, label, model)Called when the user is editing the item and pressed Enter or clicked outside of the item
- __init__()
Initialize the EditableDelegate with default values and a context menu.
- build_header(column_id)
Builds the header for a specified column in the tree view.
- Parameters
column_id (int) – Identifier for the column header to build.
- build_widget(model, item, column_id, level, expanded)
Create a widget per column per item
- Parameters
model (
ui.AbstractItemModel
) – The model that holds the data.item (
ui.AbstractItem
) – The item for which to build the widget.column_id (int) – Identifier for the column in which the widget will be placed.
level (int) – The indentation level of the item in the tree structure.
expanded (bool) – Indicates if the item’s children are expanded.
- destroy()
Cleans up the delegate by clearing subscriptions and context menus.
- on_double_click(button, field, label, model, item)
Called when the user double-clicked the item in TreeView
- Parameters
button (int) – The mouse button that was pressed.
field (
ui.StringField
) – The string field that is double-clicked.label (
ui.Label
) – The label of the item where the double click occurred.model (
ui.AbstractItemModel
) – The model containing the item.item (
ui.AbstractItem
) – The item that was double-clicked.
- on_end_edit(text, field, label, model)
Called when the user is editing the item and pressed Enter or clicked outside of the item
- Parameters
text (str) – The text entered by the user.
field (
ui.StringField
) – The string field that was being edited.label (
ui.Label
) – The label of the item that was edited.model (
ui.AbstractItemModel
) – The model containing the item.