for vendor in list(accounts.values()):
for account in list(vendor.children.values()):
item = QtGui.QListWidgetItem('%s ( %s %s - %s )'%(account.login,
account.name,
account.sname,
account.pos),
self.__contacts_list)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(account.login))
self.__contacts_list.openPersistentEditor(item)
self.__accounts[account.login] = account
##----------------------------------------------------------------------------- [ CLASS : ContactsDelegate ]
##
class CheckBoxDelegate(QtGui.QItemDelegate):
def __init__(self, parent):
#
self.__parent = parent
#
super(CheckBoxDelegate, self).__init__()
##
##
##------------------------------------------------------------------------- CREATE EDITOR
##
def createEditor(self, parent, option, index):
editor = QtGui.QCheckBox(parent)
editor.installEventFilter(self)
self.connect(editor, QtCore.SIGNAL('stateChanged(int)'), self.__parent.recvSelectionChanged)
return editor
##
##
##------------------------------------------------------------------------- SET EDITOR DATA
##
def setEditorData(self, editor, index):
editor.setText(index.data().toString())
##
##
##------------------------------------------------------------------------- SET MODEL DATA
##
def setModelData(self, editor, model, index): pass
##
##
##------------------------------------------------------------------------- UPDATE EDITOR GEOMETRY
##
def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect)
##
##
##------------------------------------------------------------------------- [ END CLASS ]