What is the purpose of TreeView.isTreeNode

Viewed 27

The TreeView attaches some properties to its delegate. One of them is isTreeNode. The documentation writes about isTreeNode:

required property bool isTreeNode - Is true if the delegate item represents a node in the tree. Only one column in the view will be used to draw the tree, and therefore, only delegate items in that column will have this property set to true. A node in the tree should typically be indented according to its depth, and show an indicator if hasChildren is true. Delegate items in other columns will have this property set to false, and will show data from the remaining columns in the model (and typically not be indented).

What is the benefit of this property? For me it looks like an alias for column == 0.

1 Answers

It's currently an alias for column === 0, like you say. But it makes the delegate more readable, and opens up for the possibility to rearrange columns at a later point, and improve the support for right-to-left layouts.

Related