MapListModel
Superclasses: Object
Implemented Interfaces: ListModel
, SectionModel
- Constructors:
MapListModel(**properties)
new(model:Gio.ListModel=None, map_func:Gtk.MapListModelMapFunc=None, user_data=None) -> Gtk.MapListModel
Constructors
- class MapListModel
Methods
- class MapListModel
-
- set_map_func(map_func: Callable[[...], Object] | None = None, *user_data: Any) None
Sets the function used to map items.
The function will be called whenever an item needs to be mapped and must return the item to use for the given input item.
Note that
GtkMapListModel
may call this function multiple times on the same item, because it may delete items it doesn’t need anymore.GTK makes no effort to ensure that
map_func
conforms to the item type ofself
. It assumes that the caller knows what they are doing and the map function returns items of the appropriate type.- Parameters:
map_func – map function
user_data – user data passed to
map_func
- set_model(model: ListModel | None = None) None
Sets the model to be mapped.
GTK makes no effort to ensure that
model
conforms to the item type expected by the map function. It assumes that the caller knows what they are doing and have set up an appropriate map function.- Parameters:
model – The model to be mapped
Properties
- class MapListModel
-
- props.item_type: type
The type of items. See
get_item_type
.Added in version 4.8.
- props.n_items: int
The number of items. See
get_n_items
.Added in version 4.8.