Skip to content

Gtk.TreeListRowSorter

class — extends Sorter

Applies a gives sorter to the levels in a tree.

Here is an example for setting up a column view with a tree model and a GtkTreeListSorter:

column_sorter = gtk_column_view_get_sorter (view);
sorter = gtk_tree_list_row_sorter_new (g_object_ref (column_sorter));
sort_model = gtk_sort_list_model_new (tree_model, sorter);
selection = gtk_single_selection_new (sort_model);
gtk_column_view_set_model (view, G_LIST_MODEL (selection));

Constructors

new

@classmethod
def new(cls, sorter: Sorter | None = ...) -> TreeListRowSorter

Create a special-purpose sorter that applies the sorting of sorter to the levels of a GtkTreeListModel.

Note that this sorter relies on TreeListModel.passthrough being False as it can only sort TreeListRows.

Parameters:

  • sorter — a GtkSorter

Methods

get_sorter

def get_sorter(self) -> Sorter | None

Returns the sorter used by self.

set_sorter

def set_sorter(self, sorter: Sorter | None = ...) -> None

Sets the sorter to use for items with the same parent.

This sorter will be passed the TreeListRow.item of the tree list rows passed to self.

Parameters:

  • sorter — The sorter to use

Properties

sorter

sorter: Sorter  # read/write

The underlying sorter