qudi.util.models

This file contains Qt models for Python data structures.

Classes

DictTableModel(headers)

Qt model storing a table in dictionaries

ListTableModel(headers)

Qt model storing a table in lists.

class qudi.util.models.DictTableModel(headers: str | Sequence[str])[source]

Bases: PySide2.QtCore.QAbstractTableModel

Qt model storing a table in dictionaries

clear()[source]
columnCount(parent: QModelIndex | None = None) int[source]

Returns the number of data fields (columns)

copy()[source]
data(index: ~PySide2.QtCore.QModelIndex, role: <class 'PySide2.QtCore.Qt.ItemDataRole'>) Any[source]

Get data from model for a given cell. Data can have a role that affects display. Re-Implement in subclass in order to support anything else than the 2 default columns.

flags(index: QModelIndex | None = None) ItemFlags[source]

Determines what can be done with the given indexed cell.

get(*args)[source]

Get value for key from dictionary.

@param args: value for key, optional default return value

@return value: value for key from dict

get_index_by_key(key: Any) int[source]

Get row index for dict key.

Warning: Row index for a key changes when keys with lower index are removed.

get_key_by_index(n: int) Any[source]

Get a dict key by index number

headerData(section: int, orientation: <class 'PySide2.QtCore.Qt.Orientation'>, role: <class 'PySide2.QtCore.Qt.ItemDataRole'> | None = PySide2.QtCore.Qt.ItemDataRole.DisplayRole) Any[source]

Data for the table view headers

items()[source]
keys()[source]
pop(*args)[source]

Remove key from dictionary.

@param args: dict key to remove, optional default return value

@return value: value removed from dict

rowCount(parent: QModelIndex | None = None) int[source]

Returns the number of stored items (rows)

staticMetaObject = <PySide2.QtCore.QMetaObject object>
update(*args, **kwargs)[source]
values()[source]
class qudi.util.models.ListTableModel(headers: str | Sequence[str])[source]

Bases: PySide2.QtCore.QAbstractTableModel

Qt model storing a table in lists.

append(data)[source]

Append a row to a table.

Parameters:
dataobject

Row to append to the table.

columnCount(parent: QModelIndex | None = None)[source]

Gives the number of data fields (columns)

copy()[source]
count(value)[source]
data(index: ~PySide2.QtCore.QModelIndex, role: <class 'PySide2.QtCore.Qt.ItemDataRole'>) Any[source]

Get data from model for a given cell. Data can have a role that affects display.

extend(seq)[source]
flags(index: QModelIndex) ItemFlags[source]

Determines what can be done with entry cells in the table view.

headerData(section: int, orientation: <class 'PySide2.QtCore.Qt.Orientation'>, role: <class 'PySide2.QtCore.Qt.ItemDataRole'> | None = PySide2.QtCore.Qt.ItemDataRole.DisplayRole) Any[source]

Data for the table view headers

insert(n, data)[source]

Insert a row into a table before the nth element.

Parameters:
nint

Index before which the row should be inserted.

dataobject

Row to insert into the table.

pop(n)[source]

Remove the nth row from a table.

Parameters:
nint

Index of the row to remove.

Returns:
object

Removed row.

remove(value)[source]
rowCount(parent: QModelIndex | None = None)[source]

Gives the number of stored items (rows)

staticMetaObject = <PySide2.QtCore.QMetaObject object>