This is my first attempt and it works:
void YourClassDerivedFromQTreeView::drawRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
if (ThisIsTheBigOne)
{
QStyleOptionViewItem opt = option;
if (selectionModel()->isSelected(index)) {
opt.state |= QStyle::State_Selected;
}
int firstSection = header()->logicalIndex(0);
int lastSection = header()->logicalIndex(header()->count() - 1);
int left = header()->sectionViewportPosition(firstSection);
int right = header()->sectionViewportPosition(lastSection) + header()->sectionSize(lastSection);
int indent = LevelOfThisItem * indentation();
left += indent;
opt.rect.setX(left);
opt.rect.setWidth(right - left);
itemDelegate(index)->paint(painter, opt, index);
}
else {
QTreeView::drawRow(painter, option, index);
}
}
. drawRow QTreeView, , itemDelegate (index) → paint, QTreeView , .