View Full Version : QTreeView: Getting the Child Indicator to align to the top of the item

10th September 2012, 14:41

I have an Item Delegate that customizes the look of the Items in a QTreeWidget, like this:

I recently added that if you click one of the items, it will expand and show additional information, like this:

I expand the item by increasing the height returned by my delegates sizeHint.

My problem is, that, as you can already see in the second image, the child indicator moves downward to the vertical center of the item.
That is a problem when a child item has children itself.

Here the item "LKW" is expanded and the current item, you can see its additional information and its children:

Here the item is closed and the current item, you can see its additional information, but the child indicator is hidden behind it:

I intentionally make the additonal information box that wide, so just limiting it to the size of the item isn't a solution.

Is there any way I can get the child indicator to be drawn at the top of the item?
I tried it via my delegate, but that doesn't really work, and the drawBranch method of QTreeView is just too complex, I don't really want to reimplement that.

14th September 2012, 18:06
I still don't have a solution, so *bump*