Uranium
Application Framework
|
Convenience base class for models of a list of items. More...
Public Member Functions | |
None | __init__ (self, parent=None) |
int | count (self) |
int | rowCount (self, parent=None) |
def | addRoleName (self, int role, str name) |
def | roleNames (self) |
def | data (self, index, role) |
Reimplemented from QAbstractListModel. | |
Dict[str, Any] | getItem (self, int index) |
List[Dict[str, Any]] | items (self) |
None | setItems (self, List[Dict[str, Any]] items) |
Replace all items at once. More... | |
def | appendItem (self, Dict[str, Any] item) |
Add an item to the list. More... | |
None | insertItem (self, int index, Dict[str, Any] item) |
Insert an item into the list at an index. More... | |
None | removeItem (self, int index) |
Remove an item from the list. More... | |
None | clear (self) |
Clear the list. More... | |
None | setProperty (self, int index, str property, Any value) |
None | sort (self, Callable[[Any], float] fun) |
Sort the list. More... | |
int | find (self, str key, Any value) |
Static Public Attributes | |
itemsChanged = pyqtSignal() | |
int | |
Get an item from the list. | |
notify | |
The list of items in this model. More... | |
result | |
This function is necessary because it is abstract in QAbstractListModel. More... | |
str | |
Find a entry by key value pair. More... | |
QVariant | |
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.
def UM.Qt.ListModel.ListModel.appendItem | ( | self, | |
Dict[str, Any] | item | ||
) |
Add an item to the list.
item | The item to add. |
None UM.Qt.ListModel.ListModel.clear | ( | self | ) |
Clear the list.
Insert an item into the list at an index.
index | The index where to insert. |
item | The item to add. |
None UM.Qt.ListModel.ListModel.removeItem | ( | self, | |
int | index | ||
) |
Remove an item from the list.
index | The index of the item to remove. |
None UM.Qt.ListModel.ListModel.setItems | ( | self, | |
List[Dict[str, Any]] | items | ||
) |
Replace all items at once.
items | The new list of items. |
None UM.Qt.ListModel.ListModel.sort | ( | self, | |
Callable[[Any], float] | fun | ||
) |
Sort the list.
fun | The callable to use for determining the sort key. |
|
static |
The list of items in this model.
|
static |
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.
|
static |
Find a entry by key value pair.
key | |
value |