class QTableView2(QTableView):
Constructor: QTableView2(gui, col_keys, col_types, col_options, ...)
QTableView2 class.
Method | __init__ |
Initializes a table. |
Method | focus |
Gets called when the table gained focus. This highlights the border and selects the last-selected cell (if any). |
Method | focus |
Gets called when the table lost focus, or when a cell is being edited. When not editing, this clears the selection, triggering on_selection_changed() . |
Method | get |
Returns the currently selected row index. |
Method | on |
Gets called when a combobox cell has been edited. |
Method | on |
Gets called when the data in a selection changed. Note: Always assuming only a single cell is selected. |
Method | on |
Gets called when a row was deleted. |
Method | on |
Gets called when the selection changed. |
Method | select |
Selects a cell. Any parameter may be left set to None in order to load its value from the selection model. |
Method | select |
Selects the last row. |
Method | set |
Sets the table contents. |
Method | set |
Sets this widget's style. |
Instance Variable | gui |
Undocumented |
Instance Variable | _allow |
Undocumented |
Instance Variable | _col |
Undocumented |
Instance Variable | _col |
Undocumented |
Instance Variable | _col |
Undocumented |
Instance Variable | _on |
Undocumented |
Instance Variable | _on |
Undocumented |
Instance Variable | _on |
Undocumented |
Instance Variable | _row |
Undocumented |
Instance Variable | _row |
Undocumented |
GUI
, col_keys: list[ str]
, col_types: dict | None
= None, col_options: list | None
= None, row_allow_delete: bool
= True, row_count_minimum: int
= 0, row_prefix: str
= '', on_cell_edited: Callable | None
= None, on_selection_changed: Callable | None
= None, on_row_deleted: Callable | None
= None):
¶
Initializes a table.
Parameters | |
gui:GUI | GUI |
collist[ | List of horizontal header strings |
coldict | None | Per-column cell types used for binding cells to configuration. Ordered dictionary of key-value pairs (column key : column type) or None to disable binding. Note: Currently, *only the keys* are used for binding cells to project configuration; the cell options actually determine the cell type, i.e. numerical or combobox. |
collist | None | Per-column cell options. This determines the cell type, i.e. numerical or combobox. List of options for every column; items may be set to None to use numerical cells. |
rowbool | Enable to add an extra column for row delete buttons |
rowint | Minimum number of rows (no further rows can be deleted) |
rowstr | Per-row prefix used for binding cells to configuration (key = prefix + column key + "_" + row index) |
onCallable | None | Set this to make cells editable |
onCallable | None | Used to inform the GUI that another row was selected |
onCallable | None | Set this to make rows deletable |
Gets called when the table gained focus. This highlights the border and selects the last-selected cell (if any).
Parameters | |
_event:QFocusEvent | QFocusEvent |
Gets called when the table lost focus, or when a cell is being edited. When not editing, this clears the selection, triggering on_selection_changed()
.
Parameters | |
_event:QFocusEvent | QFocusEvent |
Returns the currently selected row index.
Returns | |
int | None | Index of currently selected row (None if none selected) |
Gets called when a combobox cell has been edited.
Parameters | |
combobox:QComboBox | QCombobox |
row:int | Row index |
column:int | Column index |
QtCore.QModelIndex
, _bottom_right_index: QtCore.QModelIndex
):
¶
Gets called when the data in a selection changed. Note: Always assuming only a single cell is selected.
Parameters | |
topQtCore.QModelIndex | Model index of the top left selection bounds |
_bottomQtCore.QModelIndex | Model index of the bottom right selection bounds |
Gets called when the selection changed.
Parameters | |
_selected:QItemSelection | Currently selected QItemSelection |
_deselected:QItemSelection | Currently deselected QItemSelection |
Selects a cell. Any parameter may be left set to None in order to load its value from the selection model.
Parameters | |
row:int | None | Row |
col:int | None | Column |
Selects the last row.
Parameters | |
focus:bool | Enable to focus the table, disable to explicitly clear the visual selection |
Sets the table contents.
Parameters | |
data:list[ | Data (2D) |
rowlist[ | List of vertical header strings |