class comboDelegate(QtGui.QStyledItemDelegate):
def __init__(self, parent, maxNumber):
QtGui.QStyledItemDelegate.__init__(self, parent)
self.maxNumber = int(maxNumber)
def createEditor(self, parent, option, index):
self.comboChoices = ['pen','keyboard','sword']
if index.row()>self.maxNumber: background = 'rgba(211,211,211,255)'
else: background = 'white'
combo.setStyleSheet('QComboBox{color:black;background-color:'+background+';\
border-color:black;border-width: 0px;border-style:solid;}\
QComboBox QAbstractItemView{outline:0px;}\
QComboBox::drop-down{subcontrol-origin:padding;\
subcontrol-position:center right;width:10px;right:2px;\
border-top-right-radius:0px;border-bottom-right-radius:0px;\
background:none;}')
combo.addItems(self.comboChoices)
combo.currentIndexChanged[int].connect(self.currentIndexChanged)
return combo
#... Some other Delegate related functions ...
class comboDelegate(QtGui.QStyledItemDelegate):
def __init__(self, parent, maxNumber):
QtGui.QStyledItemDelegate.__init__(self, parent)
self.maxNumber = int(maxNumber)
def createEditor(self, parent, option, index):
self.comboChoices = ['pen','keyboard','sword']
combo = QtGui.QComboBox(parent)
if index.row()>self.maxNumber: background = 'rgba(211,211,211,255)'
else: background = 'white'
combo.setStyleSheet('QComboBox{color:black;background-color:'+background+';\
border-color:black;border-width: 0px;border-style:solid;}\
QComboBox QAbstractItemView{outline:0px;}\
QComboBox::drop-down{subcontrol-origin:padding;\
subcontrol-position:center right;width:10px;right:2px;\
border-top-right-radius:0px;border-bottom-right-radius:0px;\
background:none;}')
combo.addItems(self.comboChoices)
combo.currentIndexChanged[int].connect(self.currentIndexChanged)
return combo
#... Some other Delegate related functions ...
To copy to clipboard, switch view to plain text mode
Bookmarks