Model[T]
from slint import ModelModel is the base class for feeding dynamic data into Slint views.
Subclass Model to implement your own models, or use ListModel to wrap a list.
Models are iterable and can be used in for loops.
Bases: native.PyModelBase, Iterable[T]
Methods
Section titled “Methods”set_row_data
Section titled “set_row_data”Call this method on mutable models to change the data for the given row. The UI will also call this method when modifying a model’s data. Re-implement this method in a sub-class to handle the change.
row_count
Section titled “row_count”row_count() -> intReturns the number of rows in the model. Re-implement this method in a sub-class to provide the row count.
row_data
Section titled “row_data”row_data(row: int) -> T | NoneReturns the data for the given row. Re-implement this method in a sub-class to provide the data.
push_row
Section titled “push_row”push_row(value: T) -> NoneAdd a new row to the model with the provided value.
The default implementation calls insert_row with the row count.
remove_row
Section titled “remove_row”Remove the row at the given index.
Raises an exception when the model rejects the modification.
The default implementation raises NotImplementedError. A model that
supports removing rows should also call notify_row_removed.
insert_row
Section titled “insert_row”Insert a new row at the given index.
Raises an exception when the model rejects the modification.
The default implementation raises NotImplementedError. A model that
supports inserting rows should also call notify_row_added.
notify_row_changed
Section titled “notify_row_changed”Call this method from a sub-class to notify the views that a row has changed.
notify_row_removed
Section titled “notify_row_removed”Call this method from a sub-class to notify the views that
count rows have been removed starting at row.
notify_row_added
Section titled “notify_row_added”Call this method from a sub-class to notify the views that
count rows have been added starting at row.
© 2026 SixtyFPS GmbH