When I add an item to a comboBox and set it's background the selected item will not get that color. If I drop down the combo box the background is colored.
m_itemComboBox
->insertItem
(0,
file.
fileName(),
QVariant(file.
absoluteFilePath()));
m_itemComboBox
->setItemData
(0,
QString ("Non existing: %1").
arg (file.
absoluteFilePath()), Qt
::ToolTipRole);
m_itemComboBox
->setItemData
(0,
QBrush (QColor (255,
128,
64)), Qt
::BackgroundRole);
// Orange m_itemComboBox->setCurrentIndex(0);
m_itemComboBox->insertItem(0, file.fileName(), QVariant(file.absoluteFilePath()));
m_itemComboBox->setItemData(0, QString ("Non existing: %1").arg (file.absoluteFilePath()), Qt::ToolTipRole);
m_itemComboBox->setItemData(0, QBrush (QColor (255, 128, 64)), Qt::BackgroundRole); // Orange
m_itemComboBox->setCurrentIndex(0);
To copy to clipboard, switch view to plain text mode
Does anyone know how to set the background of the activated item?
Regards,
Marcel
Bookmarks