Qt, How do I change the text color of one item of a QComboBox? (C++) -


I can not understand how a text color of a particular item of QCimboBox could change how I could change the background color of an item :

comboBox-> setItemData (i, qt :: green, qt :: backgroundRole); (Qt :: Foreground Roll did not have any effect, QT 4.6, Ubuntu 10.04)

And I could change the text color of all the items with a stylesheet, but I can not understand that the text How to change the color

It is the same as your proposal, but you have to change the role of "Qt :: TextColorRole".

comboBox-> setItemData (0, QBrush (Qt :: red), Qt :: TextColorRole);


Comments