pub struct SimpleListModel<T: SimpleListItem + 'static> { /* private fields */ }
Expand description

A simple QAbstractListModel which just wrap a vector of items.

Implementations§

source§

impl<T: SimpleListItem> SimpleListModel<T>

source

pub fn insert(&mut self, index: usize, element: T)

source

pub fn push(&mut self, value: T)

source

pub fn remove(&mut self, index: usize)

source

pub fn change_line(&mut self, index: usize, value: T)

source

pub fn reset_data(&mut self, data: Vec<T>)

source

pub fn iter(&self) -> impl Iterator<Item = &T>

Returns an iterator over the items in the model

Trait Implementations§

source§

impl<T: Default + SimpleListItem + 'static> Default for SimpleListModel<T>

source§

fn default() -> SimpleListModel<T>

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

impl<'a, T> FromIterator<&'a T> for SimpleListModel<T>

source§

fn from_iter<I: IntoIterator<Item = &'a T>>(iter: I) -> SimpleListModel<T>

Creates a value from an iterator. Read more
source§

impl<T> FromIterator<T> for SimpleListModel<T>

source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> SimpleListModel<T>

Creates a value from an iterator. Read more
source§

impl<T> Index<usize> for SimpleListModel<T>
where T: SimpleListItem,

§

type Output = T

The returned type after indexing.
source§

fn index(&self, index: usize) -> &T

Performs the indexing (container[index]) operation. Read more
source§

impl<T> QAbstractListModel for SimpleListModel<T>
where T: SimpleListItem,

source§

fn row_count(&self) -> i32

Refer to the Qt documentation of QAbstractListModel::rowCount
source§

fn data(&self, index: QModelIndex, role: i32) -> QVariant

Refer to the Qt documentation of QAbstractListModel::data
source§

fn role_names(&self) -> HashMap<i32, QByteArray>

Refer to the Qt documentation of QAbstractListModel::roleNames
source§

fn get_object_description() -> &'static QObjectDescriptor
where Self: Sized,

Required for the implementation detail of the QObject custom derive
source§

fn set_data( &mut self, _index: QModelIndex, _value: &QVariant, _role: i32 ) -> bool

Refer to the Qt documentation of QAbstractListModel::setData
source§

fn begin_insert_rows(&mut self, first: i32, last: i32)

Refer to the Qt documentation of QAbstractListModel::beginInsertRows
source§

fn end_insert_rows(&mut self)

Refer to the Qt documentation of QAbstractListModel::endInsertRows
source§

fn begin_remove_rows(&mut self, first: i32, last: i32)

Refer to the Qt documentation of QAbstractListModel::beginRemoveRows
source§

fn end_remove_rows(&mut self)

Refer to the Qt documentation of QAbstractListModel::endRemoveRows
source§

fn begin_reset_model(&mut self)

Refer to the Qt documentation of QAbstractListModel::beginResetModel
source§

fn end_reset_model(&mut self)

Refer to the Qt documentation of QAbstractListModel::endResetModel
source§

fn begin_move_rows( &mut self, source_parent: QModelIndex, source_first: i32, source_last: i32, destination_parent: QModelIndex, destination_child: i32 )

Refer to the Qt documentation of QAbstractListModel::beginMoveRows
source§

fn end_move_rows(&mut self)

Refer to the Qt documentation of QAbstractListModel::endMoveRows
source§

fn data_changed(&mut self, top_left: QModelIndex, bottom_right: QModelIndex)

Refer to the Qt documentation of QAbstractListModel::dataChanged
source§

fn row_index(&self, i: i32) -> QModelIndex

Returns a QModelIndex for the given row (in the first column)
source§

impl<T: SimpleListItem + 'static> QObject for SimpleListModel<T>

source§

fn meta_object(&self) -> *const QMetaObject

Returns a pointer to a meta object
source§

fn static_meta_object() -> *const QMetaObject

Returns a pointer to a meta object
source§

fn get_cpp_object(&self) -> *mut c_void

return a C++ pointer to the QObject* (can be null if not yet initialized)
source§

unsafe fn get_from_cpp<'pinned_ref>( ptr: *mut c_void ) -> QObjectPinned<'pinned_ref, Self>

Return a rust object belonging to a C++ object
source§

unsafe fn cpp_construct(pinned: &RefCell<Self>) -> *mut c_void

Construct the C++ Object. Read more
source§

unsafe fn qml_construct( pinned: &RefCell<Self>, mem: *mut c_void, extra_destruct: extern "C" fn(_: *mut c_void) )

Construct the C++ Object, suitable for callbacks to construct QML objects.
source§

fn cpp_size() -> usize

Return the size of the C++ object
source§

fn get_object_description() -> &'static QObjectDescriptor
where Self: Sized,

Returns a QObjectDescriptor for this type

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for SimpleListModel<T>
where T: RefUnwindSafe,

§

impl<T> !Send for SimpleListModel<T>

§

impl<T> !Sync for SimpleListModel<T>

§

impl<T> Unpin for SimpleListModel<T>
where T: Unpin,

§

impl<T> UnwindSafe for SimpleListModel<T>
where T: UnwindSafe,

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>,

§

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>,

§

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.