Uranium
Application Framework
|
Public Member Functions | |
None | __init__ (self, parent=None) |
int | count (self) |
int | rowCount (self, parent=None) |
addRoleName (self, int role, str name) | |
roleNames (self) | |
data (self, index, role) | |
Dict[str, Any] | getItem (self, int index) |
List[Dict[str, Any]] | items (self) |
None | setItems (self, List[Dict[str, Any]] items) |
appendItem (self, Dict[str, Any] item) | |
None | insertItem (self, int index, Dict[str, Any] item) |
None | removeItem (self, int index) |
None | clear (self) |
None | setProperty (self, int index, str property, Any value) |
None | sort (self, Callable[[Any], float] fun, Optional[str] key=None, reverse=False) |
int | find (self, str key, Any value) |
Static Public Attributes | |
itemsChanged = pyqtSignal() | |
Protected Attributes | |
list | _items = [] |
dict | _role_names = {} |
Convenience base class for models of a list of items. This class represents a list of dictionary objects that can be exposed to QML. It is intended primarily as a read-only convenience class but supports removing elements so can also be used for limited writing.
UM.Qt.ListModel.ListModel.appendItem | ( | self, | |
Dict[str, Any] | item ) |
Add an item to the list. :param item: The item to add.
None UM.Qt.ListModel.ListModel.clear | ( | self | ) |
Clear the list.
UM.Qt.ListModel.ListModel.data | ( | self, | |
index, | |||
role ) |
Reimplemented from QAbstractListModel
int UM.Qt.ListModel.ListModel.find | ( | self, | |
str | key, | ||
Any | value ) |
Find a entry by key value pair :param key: :param value: :return: index of setting if found, None otherwise
Dict[str, Any] UM.Qt.ListModel.ListModel.getItem | ( | self, | |
int | index ) |
Get an item from the list
None UM.Qt.ListModel.ListModel.insertItem | ( | self, | |
int | index, | ||
Dict[str, Any] | item ) |
Insert an item into the list at an index. :param index: The index where to insert. :param item: The item to add.
List[Dict[str, Any]] UM.Qt.ListModel.ListModel.items | ( | self | ) |
The list of items in this model.
None UM.Qt.ListModel.ListModel.removeItem | ( | self, | |
int | index ) |
Remove an item from the list. :param index: The index of the item to remove.
int UM.Qt.ListModel.ListModel.rowCount | ( | self, | |
parent = None ) |
This function is necessary because it is abstract in QAbstractListModel. Under the hood, Qt will call this function when it needs to know how many items are in the model. This pyqtSlot will not be linked to the itemsChanged signal, so please use the normal count() function instead.
None UM.Qt.ListModel.ListModel.setItems | ( | self, | |
List[Dict[str, Any]] | items ) |
Replace all items at once. :param items: The new list of items.
None UM.Qt.ListModel.ListModel.sort | ( | self, | |
Callable[[Any], float] | fun, | ||
Optional[str] | key = None, | ||
reverse = False ) |
Sort the list. :param fun: The callable to use for determining the sort key. :param key: Use the sorting function on the underlying data :param reverse: reverse the sorted results