Trait gtk4::prelude::SorterExt[][src]

pub trait SorterExt: 'static {
    fn changed(&self, change: SorterChange);
fn compare<P: IsA<Object>, Q: IsA<Object>>(
        &self,
        item1: &P,
        item2: &Q
    ) -> Ordering;
fn order(&self) -> SorterOrder;
fn connect_changed<F: Fn(&Self, SorterChange) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }
Expand description

Required methods

Notifies all users of the sorter that it has changed.

This emits the signal::Sorter::changed signal. Users of the sorter should then update the sort order via Gtk::Sorter::compare()``.

Depending on the change parameter, it may be possible to update the sort order without a full resorting. Refer to the SorterChange documentation for details.

This function is intended for implementors of Sorter subclasses and should not be called from other functions.

change

How the sorter changed

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 order().

item1

first item to compare

item2

second item to compare

Returns

Ordering::Equal if item1 == item2, Ordering::Smaller if item1 < item2, Ordering::Larger if item1 > item2

Gets the order that self conforms to.

See SorterOrder for details of the possible return values.

This function is intended to allow optimizations.

Returns

The order

Emitted whenever the sorter changed.

Users of the sorter should then update the sort order again via gtk_sorter_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 the SorterChange documentation for details.

change

how the sorter changed

Implementors