FlattenListModel

class FlattenListModel(**properties: Any)

Superclasses: Object

Implemented Interfaces: ListModel, SectionModel

GtkFlattenListModel is a list model that concatenates other list models.

GtkFlattenListModel takes a list model containing list models, and flattens it into a single model. Each list model becomes a section in the single model.

Constructors

class FlattenListModel
classmethod new(model: ListModel | None = None) FlattenListModel

Creates a new GtkFlattenListModel that flattens list.

Parameters:

model – the model to be flattened

Methods

class FlattenListModel
get_model() ListModel | None

Gets the model set via set_model().

get_model_for_item(position: int) ListModel | None

Returns the model containing the item at the given position.

Parameters:

position – a position

set_model(model: ListModel | None = None) None

Sets a new model to be flattened.

Parameters:

model – the new model

Properties

class FlattenListModel
props.item_type: type

The type of items. See get_item_type.

Added in version 4.8.

props.model: ListModel

The model being flattened.

props.n_items: int

The number of items. See get_n_items.

Added in version 4.8.