spinetoolbox.mvcmodels.array_model
Contains model for the Array editor widget.
Module Contents
Classes
Model for the Array parameter_value type. |
- class spinetoolbox.mvcmodels.array_model.ArrayModel(parent)[source]
Bases:
PySide6.QtCore.QAbstractTableModel
Model for the Array parameter_value type.
Even if the array is empty this model’s rowCount() will still return 1. This is to show an empty row in the table view.
- Parameters
parent (QObject) – parent object
- batch_set_data(indexes, values)[source]
Sets data at multiple indexes at once.
- Parameters
indexes (list of QModelIndex) – indexes to set
values (list of str) – values corresponding to the indexes
- _convert_to_data_type(indexes, values)[source]
Converts values from string to current data type filtering failed conversions.
- Parameters
indexes (list of QModelIndex) – indexes
values (list of str) – values to convert
- Returns
indexes and converted values
- Return type
tuple
- is_expanse_row(row)[source]
Returns True if row is the expanse row.
- Parameters
row (int) – a row
- Returns
True is row is expanse row, False otherwise
- Return type
bool
- reset(value)[source]
Resets the model to a new array.
- Parameters
value (Array) – a new array to model
- rowCount(parent=QModelIndex())[source]
Returns the length of the array.
Note: returns 1 even if the array is empty.