i_slint_core::model

Struct Repeater

Source
pub struct Repeater<C: RepeatedItemTree>(/* private fields */);

Implementations§

Source§

impl<C: RepeatedItemTree + 'static> Repeater<C>

Source

pub fn ensure_updated( self: Pin<&Self>, init: impl Fn() -> VRc<ItemTreeVTable, C>, )

Call this function to make sure that the model is updated. The init function is the function to create a ItemTree

Source

pub fn ensure_updated_listview( self: Pin<&Self>, init: impl Fn() -> VRc<ItemTreeVTable, C>, viewport_width: Pin<&Property<LogicalLength>>, viewport_height: Pin<&Property<LogicalLength>>, viewport_y: Pin<&Property<LogicalLength>>, listview_width: LogicalLength, listview_height: Pin<&Property<LogicalLength>>, )

Same as Self::ensure_updated but for a ListView

Source

pub fn model_set_row_data(self: Pin<&Self>, row: usize, data: C::Data)

Sets the data directly in the model

Source

pub fn set_model_binding( &self, binding: impl Fn() -> ModelRc<C::Data> + 'static, )

Set the model binding

Source

pub fn visit( &self, order: TraversalOrder, visitor: ItemVisitorRefMut<'_>, ) -> VisitChildrenResult

Call the visitor for the root of each instance

Source

pub fn len(&self) -> usize

Return the amount of instances currently in the repeater

Source

pub fn range(&self) -> Range<usize>

Return the range of indices used by this Repeater.

Two values are necessary here since the Repeater can start to insert the data from its model at an offset.

Source

pub fn instance_at(&self, index: usize) -> Option<VRc<ItemTreeVTable, C>>

Return the instance for the given model index. The index should be within Self::range()

Source

pub fn is_empty(&self) -> bool

Return true if the Repeater as empty

Source

pub fn instances_vec(&self) -> Vec<VRc<ItemTreeVTable, C>>

Returns a vector containing all instances

Trait Implementations§

Source§

impl<C: RepeatedItemTree> Default for Repeater<C>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'pin, C: RepeatedItemTree> Unpin for Repeater<C>
where PinnedFieldsOf<__Repeater<'pin, C>>: Unpin,

Auto Trait Implementations§

§

impl<C> !Freeze for Repeater<C>

§

impl<C> !RefUnwindSafe for Repeater<C>

§

impl<C> !Send for Repeater<C>

§

impl<C> !Sync for Repeater<C>

§

impl<C> !UnwindSafe for Repeater<C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.