spinetoolbox.mvcmodels.pivot_table_models
¶
Provides pivot table models for the Tabular View.
author: |
|
---|---|
date: | 1.11.2018 |
Module Contents¶
-
class
spinetoolbox.mvcmodels.pivot_table_models.
PivotTableModel
(parent)[source]¶ Bases:
PySide2.QtCore.QAbstractTableModel
Parameters: parent (TabularViewForm) – -
rowCount
(self, parent=QModelIndex())[source]¶ Number of rows in table, number of header rows + datarows + 1 empty row
-
columnCount
(self, parent=QModelIndex())[source]¶ Number of columns in table, number of header columns + datacolumns + 1 empty columns
-
top_left_indexes
(self)[source]¶ Returns indexes in the top left area.
- Returns
- list(QModelIndex): top indexes (horizontal headers, associated to rows) list(QModelIndex): left indexes (vertical headers, associated to columns)
-
index_in_top_left
(self, index)[source]¶ Returns whether or not the given index is in top left corner, where pivot names are displayed
-
index_in_column_headers
(self, index)[source]¶ Returns whether or not the given index is in column headers (horizontal) area
-
index_in_row_headers
(self, index)[source]¶ Returns whether or not the given index is in row headers (vertical) area
-
index_in_empty_column_headers
(self, index)[source]¶ Returns whether or not the given index is in empty column headers (vertical) area
-
index_in_empty_row_headers
(self, index)[source]¶ Returns whether or not the given index is in empty row headers (vertical) area
-
map_to_pivot
(self, index)[source]¶ Returns a tuple of row and column in the pivot model that corresponds to the given model index.
Parameters: index (QModelIndex) – Returns: row int: column Return type: int
-
_top_left_id
(self, index)[source]¶ Returns the id of the top left header corresponding to the given header index.
Parameters: index (QModelIndex) – Returns: int, NoneType
-
_header_id
(self, index)[source]¶ Returns the id of the given row or column header index.
Parameters: index (QModelIndex) – Returns: int, NoneType
-
_header_ids
(self, row, column)[source]¶ Returns the ids for the headers at given row and column.
Parameters: - row (int) –
- column (int) –
Returns: tuple(int)
-
_header_name
(self, top_left_id, header_id)[source]¶ Returns the name of the header given by top_left_id and header_id.
Parameters: - top_left_id (int) – The id of the top left header
- header_id (int) – The header id
- Returns
- str
-
header_name
(self, index)[source]¶ Returns the name corresponding to the given header index.
Parameters: index (QModelIndex) – Returns: str
-
header_data
(self, index, role=Qt.DisplayRole)[source]¶ Returns the data corresponding to the given header index based on role enum.
Parameters: - index (QModelIndex) –
- role (enum Qt.ItemDataRole) –
Returns: str
-
header_names
(self, index)[source]¶ Returns the header names corresponding to the given data index.
Parameters: index (QModelIndex) – Returns: object names str: parameter name Return type: list(str)
-
value_name
(self, index)[source]¶ Returns a string that concatenates the header names corresponding to the given data index.
Parameters: index (QModelIndex) – Returns: str
-
-
class
spinetoolbox.mvcmodels.pivot_table_models.
PivotTableSortFilterProxy
(parent=None)[source]¶ Bases:
PySide2.QtCore.QSortFilterProxyModel
Initialize class.
-
set_filter
(self, identifier, filter_value)[source]¶ Sets filter for a given index (object class) name.
Parameters: - identifier (int) – index identifier
- filter_value (set, None) – A set of accepted values, or None if no filter (all pass)
-
filterAcceptsRow
(self, source_row, source_parent)[source]¶ Returns true if the item in the row indicated by the given source_row and source_parent should be included in the model; otherwise returns false.
-