pub trait QTableModelBase: QTableModel + QObjectHolder<ProxyRust = QTableModelProxyRust> {
// Provided methods
fn set(
&mut self,
index: (usize, usize),
value: <Self as QTableModel>::Item,
) -> bool { ... }
fn push_row(&mut self, values: &[Self::Item]) { ... }
fn push_column(&mut self, values: &[Self::Item]) { ... }
fn insert_row(&mut self, index: usize, values: &[Self::Item]) { ... }
fn insert_column(&mut self, index: usize, values: &[Self::Item]) { ... }
fn pop_row(&mut self) -> Option<Vec<Self::Item>> { ... }
fn pop_column(&mut self) -> Option<Vec<Self::Item>> { ... }
fn remove_row(&mut self, index: usize) -> Vec<Self::Item> { ... }
fn remove_column(&mut self, index: usize) -> Vec<Self::Item> { ... }
fn reset(&mut self) { ... }
}Expand description
A data-change signaling extension of QTableModel.
QTableModelBase provides the signaling mutation API for list models.
The methods defined in this trait wrap the corresponding
*_unnotified methods from QTableModel and automatically emit the
required Qt model signals (such as beginInsertRows, endInsertRows,
dataChanged, etc.). This allows the UI to react to changes in the
underlying data.
This trait is automatically implemented by the [qobject] macro and
should not be implemented manually.
§Usage
When modifying data that you made accessible with QTableModel, you
have to use the functions provided by this trait. Do not call the
*_unnotified methods from QTableModel directly unless you are
manually handling Qt model notifications.
The correctness of this trait depends on implementors of QTableModel
ensuring that:
- The
*_unnotifiedmethods perform the exact mutation corresponding to the emitted Qt signals. - No additional structural changes occur.
Violating this contract may result in undefined behavior in Qt views.
Provided Methods§
Sourcefn set(
&mut self,
index: (usize, usize),
value: <Self as QTableModel>::Item,
) -> bool
fn set( &mut self, index: (usize, usize), value: <Self as QTableModel>::Item, ) -> bool
Sets the item at index and notifies any attached views about
the change, if the operation is successful.
This method calls QTableModel::set_unnotified.
Returns true if the value was successfully updated,
or false if the operation failed (for example, if the index
was out of bounds or validation failed).
Sourcefn push_row(&mut self, values: &[Self::Item])
fn push_row(&mut self, values: &[Self::Item])
Appends a row of values to the end of the model and notifies any attached views about
the change.
This method calls QTableModel::push_row_unnotified.
Sourcefn push_column(&mut self, values: &[Self::Item])
fn push_column(&mut self, values: &[Self::Item])
Appends a column of value to the end of the model and notifies any attached views about
the change.
This method calls QTableModel::push_column_unnotified.
Sourcefn insert_row(&mut self, index: usize, values: &[Self::Item])
fn insert_row(&mut self, index: usize, values: &[Self::Item])
Inserts a row with values at index and notifies any attached views about
the change.
This method calls QTableModel::insert_row_unnotified.
Sourcefn insert_column(&mut self, index: usize, values: &[Self::Item])
fn insert_column(&mut self, index: usize, values: &[Self::Item])
Inserts a column with values at index and notifies any attached views about
the change.
This method calls QTableModel::insert_column_unnotified.
Sourcefn pop_row(&mut self) -> Option<Vec<Self::Item>>
fn pop_row(&mut self) -> Option<Vec<Self::Item>>
Removes and returns the last row in the model and notifies any attached views about the change.
This method calls QTableModel::pop_row_unnotified.
Returns None if the model is empty. If the model is not empty,
the function has to guarantee the success of the operation.
Sourcefn pop_column(&mut self) -> Option<Vec<Self::Item>>
fn pop_column(&mut self) -> Option<Vec<Self::Item>>
Removes and returns the last column in the model and notifies any attached views about the change.
This method calls QTableModel::pop_column_unnotified.
Returns None if the model is empty. If the model is not empty,
the function has to guarantee the success of the operation.
Sourcefn remove_row(&mut self, index: usize) -> Vec<Self::Item>
fn remove_row(&mut self, index: usize) -> Vec<Self::Item>
Removes and returns the row at index and notifies any attached views about
the change.
This method calls QTableModel::remove_row_unnotified.
Sourcefn remove_column(&mut self, index: usize) -> Vec<Self::Item>
fn remove_column(&mut self, index: usize) -> Vec<Self::Item>
Removes and returns the column at index and notifies any attached views about
the change.
This method calls QTableModel::remove_column_unnotified.
Sourcefn reset(&mut self)
fn reset(&mut self)
Resets the entire model and notifies any attached views to resyncronize all data.
This method calls QTableModel::reset_unnotified.
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.