Sorter
Superclasses: Object
Subclasses: ColumnViewSorter
, CustomSorter
, MultiSorter
, NumericSorter
, StringSorter
, TreeListRowSorter
- Constructors:
Sorter(**properties)
Methods
- class Sorter
- changed(change: SorterChange) None
Notifies all users of the sorter that it has changed.
This emits the
changed
signal. Users of the sorter should then update the sort order viacompare
.Depending on the
change
parameter, it may be possible to update the sort order without a full resorting. Refer to theSorterChange
documentation for details.This function is intended for implementers of
GtkSorter
subclasses and should not be called from other functions.- Parameters:
change – How the sorter changed
- compare(item1: Object, item2: Object) Ordering
Compares two given items according to the sort order implemented by the sorter.
Sorters implement a partial order:
It is reflexive, ie a = a
It is antisymmetric, ie if a < b and b < a, then a = b
It is transitive, ie given any 3 items with a ≤ b and b ≤ c, then a ≤ c
The sorter may signal it conforms to additional constraints via the return value of
get_order
.- Parameters:
item1 – first item to compare
item2 – second item to compare
- get_order() SorterOrder
Gets the order that
self
conforms to.See
SorterOrder
for details of the possible return values.This function is intended to allow optimizations.
Signals
- class Sorter.signals
- changed(change: SorterChange) None
Emitted whenever the sorter changed.
Users of the sorter should then update the sort order again via
compare()
.SortListModel
handles this signal automatically.Depending on the
change
parameter, it may be possible to update the sort order without a full resorting. Refer to theSorterChange
documentation for details.- Parameters:
change – how the sorter changed
Virtual Methods
- class Sorter
- do_compare(item1: Object | None = None, item2: Object | None = None) Ordering
Compares two given items according to the sort order implemented by the sorter.
Sorters implement a partial order:
It is reflexive, ie a = a
It is antisymmetric, ie if a < b and b < a, then a = b
It is transitive, ie given any 3 items with a ≤ b and b ≤ c, then a ≤ c
The sorter may signal it conforms to additional constraints via the return value of
get_order
.- Parameters:
item1 – first item to compare
item2 – second item to compare
- do_get_order() SorterOrder
Gets the order that
self
conforms to.See
SorterOrder
for details of the possible return values.This function is intended to allow optimizations.
Fields
- class Sorter
- parent_instance