customizing a QTreeView
-
Hello,
this view is a QTreeView, linked to a QStandardItemModel.In order to make this view similar to a table view, I built a delegate which removes the QTreeView identation for the items at level 2 (i.e. "Definition" is a level 1, "Name" and "Thermodynamic state" is at level 2), and sets to zero the width of the QRect near to each "title" in bold.
This is done acting on the QStyleOptionViewItem, input of
QStyledItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt, const QModelIndex &index)
This is approach for me is useful, since I can preserve the lateral arrows for expanding and compressing the main items..
Now:
(1) When resizing columns by dragging the handle I encountered this problem:
The view of some "titles" is chop: I cannot understand why, for example the first no, the last no, and the remaining yes.
(2) when moving the mouse pointer on the bold title cell, which is actually a single full width cell, with a zero width sibling, the highlight effect appears like in the the picture (I added a black thin box for evidencing a sort of double highlight)
Please, someone of you, can give me an hint?
Grazie mille
Giovanni