I have a QTreeView filled with some items and when a specific event occurs I want to highlight a few specific items in that view (by for example changing their color). How do I do that? And please, when you answer, tell the whole story, because I'm new to Qt and still many obvious things are not obvious to me.

A couple of similar threads suggest overloading the model and specifically the "data()" method to return custom color (that's correct, right?) but this would require each item to know if it should be highlighted or not. Can I somehow store that information within each item?