QStyledItemDelegate + QTreeView::setIndenation causes glitches on text drawing
Solved
General and Desktop
-
It has been two days I can not get the solution.
I have a custom QStyledItemDelegate and a QTreeView. QTreeView's indentation set to 12. And QStyledItemDelegate's QStyleOptionViewItem::rect set to -12. This set up causes glitches when I change the color of the QTreeView item's text.
void MyItemViewDelegate::initStyleOption(QStyleOptionViewItem* option, const QModelIndex& index) const { if (m_functor->operator ()(index)) { option->rect.adjust(-12, 0, 0, 0); } } MyTreeView::MyTreeView(QWidget* parent) : QTreeView(parent) { setIndentation(12); }
What did I miss?
-