Your explanation is a little confusing, but I'll give it a shot.
I'm assuming that what you're trying to do is, based on certain criteria, highlight an element in your QTreeView. What I've found helpful in applying special attributes to elements in a QTreeView (or any of the Qt Model Views) is to add a delegate that draws the cell in a special way. I usually use QModelIndex::data and QModelIndex::setData to set and test these criteria.
So, for example, in my delegate (see QItemDelegate and its examples) I may do something like
@if ( index.data( Qt::UserRole + 5).toBool() == true )
painter->fillRect( option.rect, Qt::green); // that will draw the background cell in the special highlight color.@
One nice thing about this approach is that the QItemDelegate will only draw if the node is visible. You get that part for free.