folibis
27th January 2014, 05:44
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)
9985
If I reimplement paint() with my own code:
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);
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!
My model returns brushes fo case Qt::BackgroundRole but default paint() fills a row with indent.(see attached image)
9985
If I reimplement paint() with my own code:
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);
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!