Skip to content

Gtk.SelectionFilterModel

class — extends GObject.Object, Gio.ListModel

A list model that presents the selection from a GtkSelectionModel.

Constructors

new

@classmethod
def new(cls, model: SelectionModel | None = ...) -> SelectionFilterModel

Creates a new GtkSelectionFilterModel that will include the selected items from the underlying selection model.

Parameters:

  • model — the selection model to filter

Methods

get_model

def get_model(self) -> SelectionModel | None

Gets the model currently filtered or None if none.

set_model

def set_model(self, model: SelectionModel | None = ...) -> None

Sets the model to be filtered.

Note that GTK makes no effort to ensure that model conforms to the item type of self. It assumes that the caller knows what they are doing and have set up an appropriate filter to ensure that item types match.

Parameters:

  • model — The model to be filtered

Properties

item_type

item_type: type | GObject.Type  # read-only

The type of items. See Gio.ListModel.get_item_type.

model

model: SelectionModel  # read/write

The model being filtered.

n_items

n_items: int  # read-only

The number of items. See Gio.ListModel.get_n_items.