gtk4::prelude

Trait SectionModelExt

Source
pub trait SectionModelExt: IsA<SectionModel> + 'static {
    // Provided methods
    fn section(&self, position: u32) -> (u32, u32) { ... }
    fn sections_changed(&self, position: u32, n_items: u32) { ... }
    fn connect_sections_changed<F: Fn(&Self, u32, u32) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Available on crate feature v4_12 only.
Expand description

Provided Methods§

Source

fn section(&self, position: u32) -> (u32, u32)

Query the section that covers the given position. The number of items in the section can be computed by out_end - out_start.

If the position is larger than the number of items, a single range from n_items to G_MAXUINT will be returned.

§position

the position of the item to query

§Returns
§out_start

the position of the first item in the section

§out_end

the position of the first item not part of the section anymore.

Source

fn sections_changed(&self, position: u32, n_items: u32)

This function emits the sections-changed signal to notify about changes to sections.

It must cover all positions that used to be a section start or that are now a section start. It does not have to cover all positions for which the section has changed.

The items-changed implies the effect of the sections-changed signal for all the items it covers.

It is recommended that when changes to the items cause section changes in a larger range, that the larger range is included in the emission of the items-changed instead of emitting two signals.

§position

the first changed item

§n_items

the number of changed items

Source

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

Emitted when the start-of-section state of some of the items in @model changes.

Note that this signal does not specify the new section state of the items, they need to be queried manually. It is also not necessary for a model to change the section state of any of the items in the section model, though it would be rather useless to emit such a signal.

The items-changed implies the effect of the sections-changed signal for all the items it covers.

§position

The first item that may have changed

§n_items

number of items with changes

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§