mantidimaging.gui.windows.spectrum_viewer.roi_table_model module#
- class mantidimaging.gui.windows.spectrum_viewer.roi_table_model.TableModel[source]#
Bases:
QAbstractTableModel
A subclass of QAbstractTableModel. Model for table view of ROI names and colours in Spectrum Viewer window to allow user to select which ROIs to plot.
- appendNewRow(roi_name: str, roi_colour: tuple[int, int, int], visible: bool) None [source]#
Append new row to table
@param roi_name: ROI name @param roi_colour: ROI colour
- columnCount(*args, **kwargs) int [source]#
Return number of columns in table
@return: number of columns in table
- column_data(column: int) list[str | tuple[int, int, int] | bool] [source]#
Return data from selected column
@param column: column number @return: data from selected column
- data(index: QModelIndex, role: ItemDataRole)[source]#
Set data in table roi name and colour - str and Tuple(int,int,int) and set background colour of colour column
@param index: index of selected row @param role: Qt.DisplayRole or Qt.BackgroundRole @return: ROI name or colour values and background colour of colour column
- flags(index: QModelIndex) ItemFlags [source]#
Handle selection of table rows to disable selection of ROI colour column if index is equal to roi, item not editable
@param index: index of selected row @return: Qt.ItemIsEnabled | Qt.ItemIsSelectable
- get_element(row: int, column: Literal[0]) str [source]#
- get_element(row: int, column: Literal[1]) tuple[int, int, int]
- get_element(row: int, column: Literal[2]) bool
- headerData(section: int, orientation: Orientation, role: ItemDataRole) str | None [source]#
Set horizontal colum header names to ROI and Colour
@param section: column number @param orientation: horizontal @param role: Qt.DisplayRole @return: ROI or Colour
- rename_row(row: int, new_name: str) None [source]#
Rename selected row if new name does not already exist in table and is not default ‘roi’ ROI or duplicate
@param row: row number @param new_name: new ROI name @raise ValueError: if new name already exists or is default ‘roi’ ROI
- rowCount(*args, **kwargs) int [source]#
Return number of rows in table
@return: number of rows in table
- row_data(row: int) list[str | tuple[int, int, int] | bool] [source]#
Return data from selected row
@param row: row number @return: data from selected rows