gtk.sort_list_model

Module for [SortListModel] class

Types 3

A [gio.list_model.ListModel] that sorts the elements of an underlying model according to a [gtk.sorter.Sorter].

The model is a stable sort. If two items compare equal according to the sorter, the one that appears first in the original model will also appear first after sorting. Note that if you change the sorter, the previous order will have no influence on the new order. If you want that, consider using a [gtk.multi_sorter.MultiSorter] and appending the previous sorter to it.

The model can be set up to do incremental sorting, so that sorting long lists doesn't block the UI. See [gtk.sort_list_model.SortListModel.setIncremental] for details.

[gtk.sort_list_model.SortListModel] is a generic model and because of that it cannot take advantage of any external knowledge when sorting. If you run into performance issues with [gtk.sort_list_model.SortListModel], it is strongly recommended that you write your own sorting list model.

[gtk.sort_list_model.SortListModel] allows sorting the items into sections. It implements [gtk.section_model.SectionModel] and when property@Gtk.SortListModel:section-sorter is set, it will sort all items with that sorter and items comparing equal with it will be put into the same section. The [gtk.sort_list_model.SortListModel.sorter] will then be used to sort items inside their sections.

Methods
GType _gType() @property
SortListModel self()Returns `this`, for use in `with` statements.
SortListModelGidBuilder builder()Get builder for [gtk.sortlistmodel.SortListModel] Returns: New builder object
bool incremental() @propertyGet `incremental` property. Returns: If the model should sort items incrementally.
void incremental(bool propval) @propertySet `incremental` property. Params: propval = If the model should sort items incrementally.
gobject.types.GType itemType() @propertyGet `itemType` property. Returns: The type of items. See [gio.list_model.ListModel.getItemType].
gio.list_model.ListModel model() @propertyGet `model` property. Returns: The model being sorted.
void model(gio.list_model.ListModel propval) @propertySet `model` property. Params: propval = The model being sorted.
uint nItems() @propertyGet `nItems` property. Returns: The number of items. See [gio.list_model.ListModel.getNItems].
uint pending() @propertyGet `pending` property. Returns: Estimate of unsorted items remaining.
gtk.sorter.Sorter sectionSorter() @propertyGet `sectionSorter` property. Returns: The section sorter for this model, if one is set.
void sectionSorter(gtk.sorter.Sorter propval) @propertySet `sectionSorter` property. Params: propval = The section sorter for this model, if one is set.
gtk.sorter.Sorter sorter() @propertyGet `sorter` property. Returns: The sorter for this model.
void sorter(gtk.sorter.Sorter propval) @propertySet `sorter` property. Params: propval = The sorter for this model.
bool getIncremental()Returns whether incremental sorting is enabled.
gio.list_model.ListModel getModel()Gets the model currently sorted or null if none. Returns: The model that gets sorted
uint getPending()Estimates progress of an ongoing sorting operation.
gtk.sorter.Sorter getSectionSorter()Gets the section sorter that is used to sort items of self into sections. Returns: the sorter of #self
gtk.sorter.Sorter getSorter()Gets the sorter that is used to sort self. Returns: the sorter of #self
void setIncremental(bool incremental)Sets the sort model to do an incremental sort.
void setModel(gio.list_model.ListModel model = null)Sets the model to be sorted.
void setSectionSorter(gtk.sorter.Sorter sorter = null)Sets a new section sorter on self.
void setSorter(gtk.sorter.Sorter sorter = null)Sets a new sorter on self.
Constructors
this(void * ptr, Flag!"Take" take)
this(gio.list_model.ListModel model = null, gtk.sorter.Sorter sorter = null)Creates a new sort list model that uses the sorter to sort model.
Methods
T incremental(bool propval)Set `incremental` property. Params: propval = If the model should sort items incrementally. Returns: Builder instance for fluent chaining
T model(gio.list_model.ListModel propval)Set `model` property. Params: propval = The model being sorted. Returns: Builder instance for fluent chaining
T sectionSorter(gtk.sorter.Sorter propval)Set `sectionSorter` property. Params: propval = The section sorter for this model, if one is set. Returns: Builder instance for fluent chaining
T sorter(gtk.sorter.Sorter propval)Set `sorter` property. Params: propval = The sorter for this model. Returns: Builder instance for fluent chaining

Fluent builder for [gtk.sort_list_model.SortListModel]