gtk4::prelude

Trait FilterExt

Source
pub trait FilterExt:
    IsA<Filter>
    + Sealed
    + 'static {
    // Provided methods
    fn changed(&self, change: FilterChange) { ... }
    fn strictness(&self) -> FilterMatch { ... }
    fn match_(&self, item: &impl IsA<Object>) -> bool { ... }
    fn connect_changed<F: Fn(&Self, FilterChange) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all Filter methods.

§Implementors

BoolFilter, CustomFilter, FileFilter, Filter, MultiFilter, StringFilter

Provided Methods§

Source

fn changed(&self, change: FilterChange)

Notifies all users of the filter that it has changed.

This emits the changed signal. Users of the filter should then check items again via match_().

Depending on the @change parameter, not all items need to be changed, but only some. Refer to the FilterChange documentation for details.

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

§change

How the filter changed

Source

fn strictness(&self) -> FilterMatch

Gets the known strictness of @filters.

If the strictness is not known, FilterMatch::Some is returned.

This value may change after emission of the changed signal.

This function is meant purely for optimization purposes, filters can choose to omit implementing it, but FilterListModel uses it.

§Returns

the strictness of @self

Source

fn match_(&self, item: &impl IsA<Object>) -> bool

Checks if the given @item is matched by the filter or not.

§item

The item to check

§Returns

true if the filter matches the item and a filter model should keep it, false if not.

Source

fn connect_changed<F: Fn(&Self, FilterChange) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted whenever the filter changed.

Users of the filter should then check items again via match_().

FilterListModel handles this signal automatically.

Depending on the @change parameter, not all items need to be checked, but only some. Refer to the FilterChange documentation for details.

§change

how the filter changed

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<O: IsA<Filter>> FilterExt for O