spinetoolbox.mvcmodels.time_pattern_model¶
A model for time patterns, used by the parameter value editors.
| authors: |
|
|---|---|
| date: | 4.7.2019 |
Module Contents¶
-
class
spinetoolbox.mvcmodels.time_pattern_model.TimePatternModel(value)[source]¶ Bases:
spinetoolbox.mvcmodels.indexed_value_table_model.IndexedValueTableModelA model for time pattern type parameter values.
Parameters: value (TimePattern) – a time pattern value -
insertRows(self, row, count, parent=QModelIndex())[source]¶ Inserts new time period - value pairs into the pattern.
New time periods are initialized to empty strings and the corresponding values to zeros.
Parameters: - row (int) – an index where to insert the new data
- count (int) – number of time period - value pairs to insert
- parent (QModelIndex) – an index to a parent model
Returns: True if the operation was successful
-
removeRows(self, row, count, parent=QModelIndex())[source]¶ Removes time period - value pairs from the pattern.
Parameters: - row (int) – an index where to remove the data
- count (int) – number of time period - value pairs to remove
- parent (QModelIndex) – an index to a parent model
Returns: True if the operation was successful
-
setData(self, index, value, role=Qt.EditRole)[source]¶ Sets a time period or a value in the pattern.
Column index 0 corresponds to the time periods while 1 corresponds to the values.
Parameters: - index (QModelIndex) – an index to the model
- value (str, float) – a new time period or value
- role (int) – a role
Returns: True if the operation was successful
-