spinetoolbox.mvcmodels.map_model
¶
A model for maps, used by the parameter value editors.
authors: |
|
---|---|
date: | 11.2.2020 |
Module Contents¶
-
class
spinetoolbox.mvcmodels.map_model.
MapModel
(map_value)[source]¶ Bases:
PySide2.QtCore.QAbstractTableModel
A model for Map type parameter values.
This model represents the Map as a 2D table. Each row consists of one or more index columns and a value column. The last columns of a row are padded with None.
Example
Map { "A": 1.0 "B": Map {"a": -1.0} "C": 3.0 }
The table corresponding to the above map:
“A” 1.0 None “B” “a” -1.0 “C” 3.0 None Parameters: map_value (Map) – a map -
headerData
(self, section, orientation, role=Qt.DisplayRole)[source]¶ Returns row numbers for vertical headers and column titles for horizontal ones.
-
insertRows
(self, row, count, parent=QModelIndex())[source]¶ Inserts new rows into the map.
Parameters: - row (int) – an index where to insert the new data
- count (int) – number of rows 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 rows from the map.
Parameters: - row (int) – an index where to remove the data
- count (int) – number of rows pairs to remove
- parent (QModelIndex) – an index to a parent model
Returns: True if the operation was successful
-
-
spinetoolbox.mvcmodels.map_model.
_as_rows
(map_value, row_this_far=None)[source]¶ Converts given Map into list of rows recursively.