C++ (Qt)void QFullView::drawRow ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const{ QTreeView::drawRow(painter,option,index); painter->setPen(Qt::green); painter->drawRect(option.rect);}//
C++ (Qt)void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const{... if (currentRowHasFocus) { QStyleOptionFocusRect o; o.QStyleOption::operator=(option); QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled) ? QPalette::Normal : QPalette::Disabled; o.backgroundColor = option.palette.color(cg, d->selectionModel->isSelected(index) ? QPalette::Highlight : QPalette::Background); int x = 0; if (!option.showDecorationSelected) x = header->sectionPosition(0) + d->indentationForItem(d->current); o.rect.setRect(x - header->offset(), y, header->length() - x, height); style()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, painter); // if we show focus on all columns and the first section is moved, // we have to split the focus rect into two rects if (allColumnsShowFocus && !option.showDecorationSelected && header->sectionsMoved() && (header->visualIndex(0) != 0)) { o.rect.setRect(0, y, header->sectionPosition(0), height); style()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, painter); } }....}
C++ (Qt)o.backgroundColor = option.palette.color(cg, d->selectionModel->isSelected(index) ? QPalette::Highlight : QPalette::Background);....
C++ (Qt)void QFullView::drawRow ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const{ QStyleOptionViewItem opt(option); QPalette p = opt.palette; p.setColor(QPalette::Highlight, Qt::green); opt.palette = p; opt.showDecorationSelected = true; QTreeView::drawRow(painter,opt,index);}