How about something like this?
comboBox->addItem("red");
comboBox->setItemData(0, Qt::red, Qt::BackgroundRole);
comboBox->addItem("green");
comboBox->setItemData(1, Qt::green, Qt::BackgroundRole);
comboBox->addItem("blue");
comboBox->setItemData(2, Qt::blue, Qt::BackgroundRole);
comboBox->addItem("red");
comboBox->setItemData(0, Qt::red, Qt::BackgroundRole);
comboBox->addItem("green");
comboBox->setItemData(1, Qt::green, Qt::BackgroundRole);
comboBox->addItem("blue");
comboBox->setItemData(2, Qt::blue, Qt::BackgroundRole);
To copy to clipboard, switch view to plain text mode
Bookmarks