How to change QTreeView's expand/collapse column?
I am trying to figure out how to change the column of a QTreeView that contains the expanding and collapsing controls. Been looking at all the various types of roles and options in QTreeView, QAbstractItemModel, QItemDelegate, etc. Haven't seen anything that lets me change it, although I can move the columns so I know it's possible.
I want the first column to be a single, fixed checkbox, and the second column to be the expanding +/- (triangle), icon, and name (and extra fixed columns after).
I'm not sure how that method can help me.
I ended up looking at the source code for QTreeView, and it appears that the logical column with the disclosure triangle is hard coded to 0. I am able to use moveSection() to swap the first and second columns, but on Windows it doesn't draw the highlight or mouseover effects properly, although I'm sure that can be changed with a stylesheet.
However, for now I'm just going to put the checkbox into the disclosure column. Maybe later I'll separate it out again but this layout actually saves more space.
Really all I want is an equivalent to NSOutlineView's setOutlineTableColumn method.