Hi guys,

The following code works but doesn't do in full what exactly is needed:


Qt Code:
  1. nameList = ('John','Tom','Henry','Michelle','Ashish','Jo-Huang', ...)
  2. colorNameList = ('Michelle','Jennifer','Claudia','JimSung', ...)
  3. callBackObj.NameComboBox.clear()
  4. callBackObj.NameComboBox.addItem(QString('Account Names'))
  5. model = callBackObj.NameComboBox.model()
  6. for name in nameList:
  7. item = PyQt4.QtGui.QStandardItem(str(account))
  8. if name in colorNameList:
  9. item.setBackground(PyQt4.QtGui.QColor('red'))
  10. model.appedRow(item)
To copy to clipboard, switch view to plain text mode 

Now whenever I expand and view the dropdown, the names in colorNameList appear in red background. So far so good. However when I select one of these red-background names they do not show as red-background when left selected.

Any ideas how I can ensure that on selection red items appear red and non-red appears non-red.

Many thanks!

Rahul