How can I fill a row with custom color in QTreeView?
My model returns brushes fo case Qt::BackgroundRole but default paint() fills a row with indent.(see attached image)
tree.png
If I reimplement paint() with my own code:
if (index.column() == 0)
rc.setLeft(0);
QBrush brush
= index.
model()->data
(index,Qt
::BackgroundRole).
value<QBrush>
();
painter->fillRect(rc,brush);
QRect rc(option.rect);
if (index.column() == 0)
rc.setLeft(0);
QBrush brush = index.model()->data(index,Qt::BackgroundRole).value<QBrush>();
painter->fillRect(rc,brush);
To copy to clipboard, switch view to plain text mode
so I lose all the tree primitives like dotted lines and +/- images
I need an advice how to fill a row without indent or good example how to draw tree primitives.
Thanks in advance!
Bookmarks