AbstractItemModel

class AbstractItemModel():

The central component of the item widget. It is the application’s dynamic data structure, independent of the user interface, and it directly manages the nested data. It follows closely model-view pattern. It’s abstract, and it defines the standard interface to be able to interoperate with the components of the model-view architecture. It is not supposed to be instantiated directly. Instead, the user should subclass it to create a new model.The item model doesn’t return the data itself. Instead, it returns the value model that can contain any data type and supports callbacks. Thus the client of the model can track the changes in both the item model and any value it holds.From any item, the item model can get both the value model and the nested items. Therefore, the model is flexible to represent anything from color to complicated tree-table construction.

Keyword Arguments:

Properies / Methods

def add_begin_edit_fn(self, arg0: typing.Callable[[AbstractItemModel, AbstractItem], None]) -> int:

Adds the function that will be called every time the user starts the editing. The id of the callback that is used to remove the callback.

def add_end_edit_fn(self, arg0: typing.Callable[[AbstractItemModel, AbstractItem], None]) -> int:

Adds the function that will be called every time the user finishes the editing. The id of the callback that is used to remove the callback.

def add_item_changed_fn(self, arg0: typing.Callable[[AbstractItemModel, AbstractItem], None]) -> int:

Adds the function that will be called every time the value changes. The id of the callback that is used to remove the callback.

def append_child_item(self, parentItem: AbstractItem, model: AbstractValueModel) -> AbstractItem:

Creates a new item from the value model and appends it to the list of the children of the given item.

def begin_edit(self, item: AbstractItem) -> None:

Called when the user starts the editing. If it’s a field, this method is called when the user activates the field and places the cursor inside.

def can_item_have_children(self, parentItem: AbstractItem = None) -> bool:

Returns true if the item can have children. In this way the delegate usually draws +/- icon. ### Arguments: id : The item to request children from. If it’s null, the children of root will be returned.

def drop(self, item_tagget: AbstractItem, item_source: AbstractItem, drop_location: int = -1) -> None:

Called when the user dropped one item to another. Small explanation why the same default value is declared in multiple places. We use the default value to be compatible with the previous API and especially with Stage 2.0. Thr signature in the old Python API is: def drop(self, target_item, source) drop(self, target_item, source) PyAbstractItemModel::drop AbstractItemModel.drop pybind11::class_<AbstractItemModel>.def(“drop”) AbstractItemModel Called when the user dropped a string to the item.

def drop_accepted(self, item_tagget: AbstractItem, item_source: AbstractItem, drop_location: int = -1) -> bool:

Called to determine if the model can perform drag and drop to the given item. If this method returns false, the widget shouldn’t highlight the visual element that represents this item. Called to determine if the model can perform drag and drop of the given string to the given item. If this method returns false, the widget shouldn’t highlight the visual element that represents this item.

def end_edit(self, item: AbstractItem) -> None:

Called when the user finishes the editing. If it’s a field, this method is called when the user presses Enter or selects another field for editing. It’s useful for undo/redo.

def get_drag_mime_data(self, item: AbstractItem = None) -> str:

Returns Multipurpose Internet Mail Extensions (MIME) for drag and drop.

def get_item_children(self, parentItem: AbstractItem = None) -> typing.List[AbstractItem]:

Returns the vector of items that are nested to the given parent item. ### Arguments: id : The item to request children from. If it’s null, the children of root will be returned.

def get_item_value_model(self, item: AbstractItem = None, column_id: int = 0) -> AbstractValueModel:

Get the value model associated with this item. ### Arguments: item : The item to request the value model from. If it’s null, the root value model will be returned. index : The column number to get the value model.

def get_item_value_model_count(self, item: AbstractItem = None) -> int:

Returns the number of columns this model item contains.

def remove_begin_edit_fn(self, arg0: int) -> None:

Remove the callback by its id. ### Arguments: id : The id that addBeginEditFn returns.

def remove_end_edit_fn(self, arg0: int) -> None:

Remove the callback by its id. ### Arguments: id : The id that addEndEditFn returns.

def remove_item(self, item: AbstractItem) -> None:

Removes the item from the model. There is no parent here because we assume that the reimplemented model deals with its data and can figure out how to remove this item.

def remove_item_changed_fn(self, arg0: int) -> None:

Remove the callback by its id. ### Arguments: id : The id that addValueChangedFn returns.

def subscribe_begin_edit_fn(self, arg0: typing.Callable[[AbstractItemModel, AbstractItem], None]) -> carb._carb.Subscription:

Adds the function that will be called every time the user starts the editing. The id of the callback that is used to remove the callback.

def subscribe_end_edit_fn(self, arg0: typing.Callable[[AbstractItemModel, AbstractItem], None]) -> carb._carb.Subscription:

Adds the function that will be called every time the user finishes the editing. The id of the callback that is used to remove the callback.

def subscribe_item_changed_fn(self, arg0: typing.Callable[[AbstractItemModel, AbstractItem], None]) -> carb._carb.Subscription:

Adds the function that will be called every time the value changes. The id of the callback that is used to remove the callback.