Uranium
Application Framework
UM.Qt.ListModel.ListModel Class Reference

Convenience base class for models of a list of items. More...

Inheritance diagram for UM.Qt.ListModel.ListModel:
UM.Qt.Bindings.OutputDevicesModel.OutputDevicesModel UM.Settings.Models.ContainerStacksModel.ContainerStacksModel UM.Settings.Models.DefinitionContainersModel.DefinitionContainersModel UM.Settings.Models.InstanceContainersModel.InstanceContainersModel

Public Member Functions

def __init__ (self, parent=None)
 
def rowCount (self, parent=None)
 
def addRoleName (self, role, name)
 
def roleNames (self)
 
def data (self, index, role)
 Reimplemented from QAbstractListModel.
 
def getItem (self, index)
 
def items (self)
 
def setItems (self, items)
 Replace all items at once. More...
 
def appendItem (self, item)
 Add an item to the list. More...
 
def insertItem (self, index, item)
 Insert an item into the list at an index. More...
 
def removeItem (self, index)
 Remove an item from the list. More...
 
def clear (self)
 Clear the list. More...
 
def setProperty (self, index, property, value)
 
def sort (self, fun)
 Sort the list. More...
 
def find (self, key, value)
 

Static Public Attributes

 result
 Reimplemented from QAbstractListModel.
 
 int
 Get an item from the list.
 
 itemsChanged = pyqtSignal()
 
 notify
 The list of items in this model. More...
 
 str
 Find a entry by key value pair. More...
 
 QVariant
 

Detailed Description

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.

Member Function Documentation

◆ appendItem()

def UM.Qt.ListModel.ListModel.appendItem (   self,
  item 
)

Add an item to the list.

Parameters
itemThe item to add.

◆ clear()

def UM.Qt.ListModel.ListModel.clear (   self)

Clear the list.

◆ insertItem()

def UM.Qt.ListModel.ListModel.insertItem (   self,
  index,
  item 
)

Insert an item into the list at an index.

Parameters
indexThe index where to insert.
itemThe item to add.

◆ removeItem()

def UM.Qt.ListModel.ListModel.removeItem (   self,
  index 
)

Remove an item from the list.

Parameters
indexThe index of the item to remove.

◆ setItems()

def UM.Qt.ListModel.ListModel.setItems (   self,
  items 
)

Replace all items at once.

Parameters
itemsThe new list of items.

◆ sort()

def UM.Qt.ListModel.ListModel.sort (   self,
  fun 
)

Sort the list.

Parameters
funThe callable to use for determining the sort key.

Member Data Documentation

◆ notify

UM.Qt.ListModel.ListModel.notify
static

The list of items in this model.

◆ str

UM.Qt.ListModel.ListModel.str
static

Find a entry by key value pair.

Parameters
key
value
Returns
index of setting if found, None otherwise

The documentation for this class was generated from the following file: