easymodel.treemodel.ListItemData¶
-
class
easymodel.treemodel.ListItemData(liste, editable=False)[source]¶ Bases:
easymodel.treemodel.ItemDataItem data for generic lists
Initialize it with a list of objects. Each element corresponds to a column. For DisplayRole the objects are converted to strings with
str().Initialize a new StringItemData with the given list
Parameters: - list (list of objects) – a list of objects, one for each column
- editable (
bool) – If True, the list is editable
Raises: None
-
__init__(liste, editable=False)[source]¶ Initialize a new StringItemData with the given list
Parameters: - list (list of objects) – a list of objects, one for each column
- editable (
bool) – If True, the list is editable
Raises: None
Methods
__init__(liste[, editable])Initialize a new StringItemData with the given list column_count()Return the number of columns that can be queried for data data(column, role)Return the data for the specified column and role flags(column)Return the item flags for the item internal_data()Return the list set_data(column, value, role)Set the data for the given column to value to_item(*args, **kwargs)Create and return a new TreeItemout of this instance.-
data(column, role)[source]¶ Return the data for the specified column and role
For DisplayRole the element in the list will be converted to a sting and returned.
Parameters: - column (int) – the data column
- role (QtCore.Qt.ItemDataRole) – the data role
Returns: data depending on the role, or None if the column is out of range
Return type: depending on the role or None
Raises: None
-
set_data(column, value, role)[source]¶ Set the data for the given column to value
The default implementation returns False
Parameters: - column (int) – the column to set
- value – the value to set
- role (
QtCore.Qt.ItemDataRole) – the role, usually EditRole
Returns: True, if editing was successfull
Return type: Raises: None