I have QCombobox, QStandardItemModel is used as a data model for it, every item in QCombobox it is a QStandardItem respectively, QTreeView is used as view. I try to select some (parent) combobox items by blue color like this:
Qt Code:
  1. QStandardItem* all = new QStandardItem("some text");
  2. all->setForeground(QBrush(QColor(Qt::blue)));
To copy to clipboard, switch view to plain text mode 
or like this:
Qt Code:
  1. all->setData(Qt::blue, Qt::ForegroundRole);
To copy to clipboard, switch view to plain text mode 
In drop down list (tree) that element (item) is blue (highlighted), however when I select that item its text becomes black again which is default for all the items in the combobox. How can I fix that to keep desired item color when I select it?