Header of first column overlaps the expand/collapse indicator in QTreeView
-
Hello,
I am experimenting with QTreeView. As can be seen from the screenshot below, there are two columns: Title, and Description. The "Title" column overlaps with the expand/collapse indicator of the group parent row.The "Title" column is editable. Even though the "Title" column header is displayed all the way to the left edge, one has to remember to move to the right and click in the appropriate cell location in order to edit the "Title". When there is text in the "Title" it serves as a cue for the click location. However when there is no text, there is no proper guidance to the user as to where to click in order make the edit field open up in the child "Title" cell.
Is there a way to create a column for the "Expand/Collapse" indicator, and move the "Title" column to be directly above the start of the "Title" cells in the child rows?
-
@johnga said in Header of first column overlaps the expand/collapse indicator in QTreeView:
Is there a way to create a column for the "Expand/Collapse" indicator, and move the "Title" column to be directly above the start of the "Title" cells in the child rows?
No since the collapse/expand icons belong to the first column.
-
Well yes, actually. Just make an extra column, don't give it a label and set its header section to fixed size.
Then your expand/collapse column would be index 0, Title would become index 1 and Description index 2 -
@chris-kawa said in Header of first column overlaps the expand/collapse indicator in QTreeView:
set its header section to fixed size.
But how much size? This space depends on the style and the tree depth.
-
@christian-ehrlicher said in Header of first column overlaps the expand/collapse indicator in QTreeView:
But how much size? This space depends on the style and the tree depth.
The default indentation can be acquired by calling indentation() and the depth, by looking at the picture, is fixed. If not you can still manually set column size on expanded/collapsed signals.
Or you could just set it to automatically adjust to contents.