By default, QComboBox
uses a QStandardItemModel, so the QStandardItem methods can be used to change the various display properties:
combo = QComboBox()
model = combo.model()
for row in range(10):
item = QStandardItem(str(row))
item.setForeground(QColor('red'))
font = item.font()
font.setPointSize(10)
item.setFont(font)
model.appendRow(item)
PS:
If you want to reset one of the item properties, set it to None
, like this:
item = self.combo.model().item(row)
item.setData(None, Qt.ForegroundRole)