spinetoolbox.mvcmodels.minimal_table_model
¶
Contains a minimal table model.
authors: |
|
---|---|
date: | 20.5.2018 |
Module Contents¶
-
class
spinetoolbox.mvcmodels.minimal_table_model.
MinimalTableModel
(parent=None, header=None, lazy=True)[source]¶ Bases:
PySide2.QtCore.QAbstractTableModel
Table model for outlining simple tabular data.
Parameters: parent (QObject) – the parent object -
insert_horizontal_header_labels
(self, section, labels)[source]¶ Insert horizontal header labels at the given section.
-
setHeaderData
(self, section, orientation, value, role=Qt.EditRole)[source]¶ Sets the data for the given role and section in the header with the specified orientation to the value supplied.
-
data
(self, index, role=Qt.DisplayRole)[source]¶ Returns the data stored under the given role for the item referred to by the index.
Parameters: - index (QModelIndex) – Index of item
- role (int) – Data role
Returns: Item data for given role.
-
row_data
(self, row, role=Qt.DisplayRole)[source]¶ Returns the data stored under the given role for the given row.
Parameters: - row (int) – Item row
- role (int) – Data role
Returns: Row data for given role.
-
insertRows
(self, row, count, parent=QModelIndex())[source]¶ Inserts count rows into the model before the given row. Items in the new row will be children of the item represented by the parent model index.
Parameters: - row (int) – Row number where new rows are inserted
- count (int) – Number of inserted rows
- parent (QModelIndex) – Parent index
Returns: True if rows were inserted successfully, False otherwise
-
insertColumns
(self, column, count, parent=QModelIndex())[source]¶ Inserts count columns into the model before the given column. Items in the new column will be children of the item represented by the parent model index.
Parameters: - column (int) – Column number where new columns are inserted
- count (int) – Number of inserted columns
- parent (QModelIndex) – Parent index
Returns: True if columns were inserted successfully, False otherwise
-
removeRows
(self, row, count, parent=QModelIndex())[source]¶ Removes count rows starting with the given row under parent.
Parameters: - row (int) – Row number where to start removing rows
- count (int) – Number of removed rows
- parent (QModelIndex) – Parent index
Returns: True if rows were removed successfully, False otherwise
-
removeColumns
(self, column, count, parent=QModelIndex())[source]¶ Removes count columns starting with the given column under parent.
Parameters: - column (int) – Column number where to start removing columns
- count (int) – Number of removed columns
- parent (QModelIndex) – Parent index
Returns: True if columns were removed successfully, False otherwise
-