Skip to main content

StringTableModel

Struct StringTableModel 

Source
pub struct StringTableModel { /* private fields */ }
Expand description

A string table model that drives a Qt QTableView incrementally.

Rows are Vec<String>; changes are applied to the C++ QAbstractTableModel with beginInsertRows/beginRemoveRows/dataChanged.

Implementations§

Source§

impl StringTableModel

Source

pub fn new(columns: usize, headers: impl IntoIterator<Item = String>) -> Self

Create a table with columns columns and the given header labels.

Source

pub fn bind_rows(&self, signal: &Signal<Vec<Vec<String>>>)

Bind the table’s rows to a signal: every emission replaces all rows. The subscription lives as long as the model.

Source

pub fn set_headers(&self, headers: impl IntoIterator<Item = String>)

Replace the column headers.

Source

pub fn bind_headers(&self, signal: &Signal<Vec<String>>)

Bind the column headers to a signal.

Source

pub fn set_row_icons(&self, paths: impl IntoIterator<Item = String>)

Set a per-row icon for column 0, given the file path whose icon should be shown (e.g. an executable). Empty paths show no icon.

Source

pub fn bind_row_icons(&self, signal: &Signal<Vec<String>>)

Bind per-row icons (file paths whose icon appears in column 0) to a signal. The subscription lives as long as the model.

Source

pub fn set_heat(&self, column: usize, values: impl IntoIterator<Item = f64>)

Set normalized (0..1) heat values for column, rendered as a translucent intensity wash by the view’s heat delegate.

Source

pub fn bind_heat(&self, column: usize, signal: &Signal<Vec<f64>>)

Bind normalized heat values for column to a signal.

Source

pub fn bind_table(&self, signal: &Signal<Vec<(Vec<String>, String)>>)

Bind rows and their column-0 icons from one signal of (cells, icon path) pairs. Rows and icons are applied atomically in a single observer, so a row reset can never wipe the same-pass icons.

Source

pub fn row_icon_count(&self) -> usize

Number of rows with a non-null icon in column 0.

Source

pub fn set_column_alignment(&self, column: usize, align: TextAlign)

Set the horizontal alignment of column.

Source

pub fn row_count(&self) -> usize

Number of rows in the C++ mirror.

Source

pub fn column_count(&self) -> usize

Number of columns.

Source

pub fn cell(&self, row: usize, column: usize) -> String

The cell text at (row, column) as stored in the C++ mirror.

Source

pub fn push_row(&self, row: impl IntoIterator<Item = String>)

Append a row.

Source

pub fn insert_row(&self, index: usize, row: impl IntoIterator<Item = String>)

Insert a row at index.

Source

pub fn remove_row(&self, index: usize) -> bool

Remove the row at index.

Source

pub fn set_row( &self, index: usize, row: impl IntoIterator<Item = String>, ) -> bool

Replace the row at index.

Source

pub fn clear(&self)

Remove every row.

Source

pub fn replace_all(&self, rows: impl IntoIterator<Item = Vec<String>>)

Replace the whole table.

Trait Implementations§

Source§

impl Clone for StringTableModel

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.